From 07fd8d3ba58d00ad4b0e3ed4ca21428800e492e3 Mon Sep 17 00:00:00 2001 From: kcr Date: Mon, 22 Dec 2008 18:15:15 +0000 Subject: [PATCH] replace gratuitous use sprintf with strncpy and edifying comment. Also fix fencepost error. git-svn-id: svn://svn.1ts.org/debian/branches/zephyr-reloaded@381 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f --- zephyr/server/dispatch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zephyr/server/dispatch.c b/zephyr/server/dispatch.c index ae65cc4..28d39ec 100644 --- a/zephyr/server/dispatch.c +++ b/zephyr/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); } -- 2.45.2