INN commit: trunk/innd (art.c)

INN Commit Russ_Allbery at isc.org
Fri May 1 09:04:36 UTC 2009


    Date: Friday, May 1, 2009 @ 02:04:34
  Author: iulius
Revision: 8437

Fix a bug during the parsing of message-IDs:  USEFOR allows
leading and trailing white spaces in the Message-Id: and
Supersedes: headers.  Articles containing such white spaces
were rejected by innd.

Thanks to Petr Novopashenniy for having reported this issue.

Modified:
  trunk/innd/art.c

-------+
 art.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Modified: art.c
===================================================================
--- art.c	2009-05-01 09:00:21 UTC (rev 8436)
+++ art.c	2009-05-01 09:04:34 UTC (rev 8437)
@@ -680,12 +680,23 @@
     cp->Data.BytesHeader = header;
   hc = &hc[i];
   if (hc->Length != 0) {
-    /* duplicated */
+    /* Duplicated. */
     hc->Length = -1;
   } else {
-    hc->Value = colon + 2;
-    /* HDR_LEN() does not include trailing "\r\n" */
-    hc->Length = size - (hc->Value - header) - 2;
+    /* We need to remove leading and trailing spaces for
+     * message-IDs; otherwise, ARTidok() will fail. */
+    if (i == HDR__MESSAGE_ID || i == HDR__SUPERSEDES) {
+      for (p = colon + 1 ; (p < header + size - 2) &&
+           (ISWHITE(*p)) ; p++);
+      hc->Value = p;
+      for (p = header + size - 3 ; (p > hc->Value) &&
+           (ISWHITE(*p)) ; p--);
+      hc->Length = p - hc->Value + 1;
+    } else {
+      hc->Value = colon + 2;
+      /* HDR_LEN() does not include trailing "\r\n". */
+      hc->Length = size - (hc->Value - header) - 2;
+    }
   }
   return;
 }




More information about the inn-committers mailing list