INN commit: trunk/nnrpd (post.c)
INN Commit
rra at isc.org
Sun Jun 14 10:11:06 UTC 2015
Date: Sunday, June 14, 2015 @ 03:11:06
Author: iulius
Revision: 9898
nnrpd: don't strlcpy with equal source/dest
strlcpy with overlapping source & destination has undefined behavior.
(INN's version of the function passes the source and destination to
memcpy, which also has undefined behavior when they overlap.)
Thanks to Richard Kettlewell for the patch.
Modified:
trunk/nnrpd/post.c
--------+
post.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Modified: post.c
===================================================================
--- post.c 2015-06-14 10:10:37 UTC (rev 9897)
+++ post.c 2015-06-14 10:11:06 UTC (rev 9898)
@@ -1155,8 +1155,9 @@
if (modgroup)
snprintf(idbuff, SMBUF, "(mailed to moderator for %s)",
modgroup);
- else
- strlcpy(idbuff, HDR(HDR__MESSAGEID), SMBUF);
+ else if (HDR(HDR__MESSAGEID) != idbuff) {
+ strlcpy(idbuff, HDR(HDR__MESSAGEID), SMBUF);
+ }
}
if (strncmp(p, "DROP", 4) == 0) {
syslog(L_NOTICE, "%s post failed %s", Client.host, p);
@@ -1206,8 +1207,9 @@
return MailArticle(modgroup, article);
}
- if (idbuff)
- strlcpy(idbuff, HDR(HDR__MESSAGEID), SMBUF);
+ if (idbuff != NULL && HDR(HDR__MESSAGEID) != idbuff) {
+ strlcpy(idbuff, HDR(HDR__MESSAGEID), SMBUF);
+ }
if (PERMaccessconf->spoolfirst)
return Spoolit(article, Error);
More information about the inn-committers
mailing list