INN commit: branches/2.5/nnrpd (post.c)

INN Commit rra at isc.org
Sat Jan 14 09:44:57 UTC 2012


    Date: Saturday, January 14, 2012 @ 01:44:57
  Author: iulius
Revision: 9396

fix a segfault when a message does not contain a Newsgroups: header field

A bug was introduced by [9121] (also in STABLE, but not in a release).
The Newsgroups: header field was strdup'ed before having checked the
validity of all the header fields.  It could therefore be unset, leading
to a segfault.

The check is now done.  If the Newsgroups: header field is missing,
this error will still be reported afterwards.  And in case it is set, the
presence of a moderated newsgroup is properly checked, and nnrpd acts
accordingly (it does not add or update Injection-Date:, Injection-Info:
and Path: header fields in this case).

Modified:
  branches/2.5/nnrpd/post.c

--------+
 post.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Modified: post.c
===================================================================
--- post.c	2012-01-14 09:44:03 UTC (rev 9395)
+++ post.c	2012-01-14 09:44:57 UTC (rev 9396)
@@ -1059,9 +1059,15 @@
     /* modgroup is set when moderated newsgroups are found in the
      * Newsgroups: header field, and the article does not contain
      * an Approved: header field.
-     * Therefore, moderation will be needed. */
-    if ((error = ValidNewsgroups(HDR(HDR__NEWSGROUPS), &modgroup)) != NULL)
-        return error;
+     * Therefore, moderation will be needed.
+     *
+     * Be sure to check that a Newsgroups: header field exists
+     * because ProcessHeaders() still has not been called.  It would
+     * have rejected the message. */
+    if (HDR(HDR__NEWSGROUPS) != NULL) {
+        if ((error = ValidNewsgroups(HDR(HDR__NEWSGROUPS), &modgroup)) != NULL)
+            return error;
+    }
 
     if ((error = ProcessHeaders(i, idbuff, ihave, modgroup != NULL)) != NULL) {
         if (modgroup != NULL)




More information about the inn-committers mailing list