INN commit: trunk/nnrpd (post.c)
INN Commit
Russ_Allbery at isc.org
Mon May 4 19:44:55 UTC 2009
Date: Monday, May 4, 2009 @ 12:44:55
Author: iulius
Revision: 8444
Fix a segfault in nnrpd when a NULL pointer is passed as the first
argument of MaxLength. Also see commit 8396 for innd.
Modified:
trunk/nnrpd/post.c
--------+
post.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Modified: post.c
===================================================================
--- post.c 2009-05-04 19:18:50 UTC (rev 8443)
+++ post.c 2009-05-04 19:44:55 UTC (rev 8444)
@@ -95,6 +95,13 @@
static char buff[80];
unsigned int i;
+
+ /* Return an empty string when p is NULL. */
+ if (p == NULL) {
+ *buff = '\0';
+ return buff;
+ }
+
/* Already short enough? */
i = strlen(p);
if (i < sizeof buff - 1)
@@ -105,7 +112,7 @@
q = p;
/* Simple case of just want the begining? */
- if ((size_t)(q - p) < sizeof(buff) - 4) {
+ if (q == NULL || (size_t)(q - p) < sizeof(buff) - 4) {
strlcpy(buff, p, sizeof(buff) - 3);
strlcat(buff, "...", sizeof(buff));
} else if ((p + i) - q < 10) {
More information about the inn-committers
mailing list