]> asedeno.scripts.mit.edu Git - 1ts-debian.git/commitdiff
complicated krb4 arithmetic -> MAX_PRINCIPAL_SIZE
authorkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Sun, 21 Dec 2008 08:45:58 +0000 (08:45 +0000)
committerkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Sun, 21 Dec 2008 08:45:58 +0000 (08:45 +0000)
also check the size of what we're sprintfing into

git-svn-id: svn://svn.1ts.org/debian/branches/zephyr-reloaded@367 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f

zephyr/server/dispatch.c

index cd7ac7948a3a1b32d29ae07f322e9fbed97158e9..ae65cc4d1802856412784a0a6d4620cd186abfdc 100644 (file)
@@ -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);
     }