summaryrefslogtreecommitdiff
path: root/server/dispatch.c
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@mit.edu>2008-12-22 18:15:15 +0000
committerGravatar Karl Ramm <kcr@mit.edu>2008-12-22 18:15:15 +0000
commit12d84bdebb22488f9ad5e70473d84c5b471ad2b2 (patch)
treeaecd87c194d905231fe1feba38a153a9efb6ecf1 /server/dispatch.c
parent966682cf85c2413f709a45c1237b3574358b515f (diff)
replace gratuitous use sprintf with strncpy and edifying comment. Also fix fencepost error.
Diffstat (limited to 'server/dispatch.c')
-rw-r--r--server/dispatch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/dispatch.c b/server/dispatch.c
index 56c38ad..912ffcd 100644
--- a/server/dispatch.c
+++ b/server/dispatch.c
@@ -389,8 +389,12 @@ sendit(ZNotice_t *notice,
strncpy(recipbuf, notice->z_recipient, sizeof(recipbuf));
recipp = strrchr(recipbuf, '@');
if (recipp)
- snprintf(recipp + 1, sizeof(recipbuf) - (recipp - recipbuf),
- "%s", realm_expand_realm(recipp + 1));
+ /* XXX if realm_expand_realm doesn't find a match
+ * it returns what's passed into it, causing an overlapping
+ * copy, the results of which are undefined.
+ */
+ strncpy(recipp + 1, realm_expand_realm(recipp + 1),
+ sizeof(recipbuf) - (recipp - recipbuf) - 1);
dest.recip = make_string(recipbuf, 0);
}