Arrgh! latest innfeed crashes like heck!

Sven Paulus sven at tin.org
Wed Apr 26 14:01:49 UTC 2000


In article <ylbt2x1ni5.fsf at windlord.stanford.edu> you wrote:
|>> Son of 1036 limits the overall length of a Message-ID to 250
|>> octets. innfeed could just drop articles with ID which are longer,
|>> configurable per peer, but this isn't a nice solution at all. Being more
|>> robust towards broken peers is better. And before a Message-ID starts
|>> looping we should better drop it ...
|> True, and I agree with adding something like this to innfeed, but
|> shouldn't innd have also already rejected such an article?  I don't think
|> innd should accept articles with message IDs so long that to send them
|> back out requires breaking the NNTP protocol, and we're already picky
|> about message IDs....

Sounds reasonable. Maybe we should add a compile time variable
"MAXMSGIDSIZE" which specifies the maximum length of Message-ID
header we accept and redistribute (for innd and innfeed, double security is
better security and the strlen() is cheap). The default setting is
250. People who want to comply older standards which allow longer IDs
can increase the value on their own risk.

I thought of something like this (the configure-part for --max-msgid-size ->
configdata.h is missing, I don't know how to do this):

--- innd/art.c	Fri Nov 19 07:20:43 1999
+++ innd/art.c.new	Wed Apr 26 15:41:36 2000
@@ -873,6 +873,10 @@
     int	                c;
     const char	        *p;
 
+    /* Check max. length */
+    if (!MessageID || strlen(MessageID) > MAXMSGIDSIZE)
+	return FALSE;
+
     /* Scan local-part:  "< atom|quoted [ . atom|quoted]" */
     p = MessageID;
     if (*p++ != '<')



--- innfeed/innlistener.c	Sun Mar  7 20:45:48 1999
+++ innfeed/innlistener.c.new	Wed Apr 26 15:56:32 2000
@@ -536,14 +536,21 @@
              rest of the command line. Will return null if file is missing. */
           article = newArticle (fileName, msgid) ;
           *fileNameEnd = ' ' ;
+
+	  /* Check if message ID exceeds max. length */
+          if ((int)(msgidEnd-msgid) >= MAXMSGIDSIZE) {
+            syslog(LOG_ERR, INN_MSGID_SIZE, MAXMSGIDSIZE, msgid);
+            *(msgidEnd+1) = '\0';
+          }
+
           *msgidEnd = ' ' ;
 
           /* Check if message ID starts with < and ends with > */
           if (*msgid != '<' || *(msgidEnd-1) != '>') {
-            syslog(LOG_ERR,INN_BAD_CMD,cmd);
+            syslog(LOG_ERR,INN_BAD_MSGID,cmd);
             *(msgidEnd+1) = '\0';
           }



--- msgs.h	Sun Oct 10 07:12:31 1999
+++ /sys/src/inn-000323/innfeed/msgs.h.new	Wed Apr 26 15:57:12 2000
@@ -117,6 +117,8 @@
 #define INN_GONE                "ME source lost . Exiting"
 #define INN_IO_ERROR            "ME source read error Exiting : %m"
 #define INN_BAD_CMD             "ME source format bad Exiting : %s"
+#define INN_BAD_MSGID           "ME source format bad : %s"
+#define INN_MSGID_SIZE          "ME message id exceeds limit of %d octets : %s"
 #define TOO_MANY_HOSTS          "ME internal too may hosts. (max is %d)"
 #define DYNAMIC_PEER            "ME unconfigured peer %s added"
 #define UNKNOWN_PEER            "ME unconfigured peer %s"


Comments?

Sven




More information about the inn-workers mailing list