summaryrefslogtreecommitdiff
path: root/server/dispatch.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2008-12-21 08:45:58 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2008-12-21 08:45:58 +0000
commit2edaa2eb24e3ee2b87abd6c51b93abf94544dd30 (patch)
tree6fd561064b888716f0e9bc9379df1e615e99a3f0 /server/dispatch.c
parent5533fcda301df554c70c79c234f37063e5110534 (diff)
complicated krb4 arithmetic -> MAX_PRINCIPAL_SIZE
also check the size of what we're sprintfing into
Diffstat (limited to 'server/dispatch.c')
-rw-r--r--server/dispatch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/dispatch.c b/server/dispatch.c
index 01c5a2f..56c38ad 100644
--- a/server/dispatch.c
+++ b/server/dispatch.c
@@ -320,7 +320,7 @@ sendit(ZNotice_t *notice,
int external)
{
static int send_counter = 0;
- char recipbuf[ANAME_SZ + INST_SZ + REALM_SZ + 3], *recipp;
+ char recipbuf[MAX_PRINCIPAL_SIZE], *recipp;
int any = 0;
Acl *acl;
Destination dest;
@@ -389,7 +389,8 @@ sendit(ZNotice_t *notice,
strncpy(recipbuf, notice->z_recipient, sizeof(recipbuf));
recipp = strrchr(recipbuf, '@');
if (recipp)
- sprintf(recipp + 1, "%s", realm_expand_realm(recipp + 1));
+ snprintf(recipp + 1, sizeof(recipbuf) - (recipp - recipbuf),
+ "%s", realm_expand_realm(recipp + 1));
dest.recip = make_string(recipbuf, 0);
}