(fwd) Patch for Distribution header problem

Clifton Royston cliftonr at lava.net
Fri Nov 19 00:38:47 UTC 1999


Path: news.lava.net!cliftonr
From: cliftonr at lava.net (Clifton Royston)
Newsgroups: news.software.nntp
Subject: Patch for Distribution header problem
Date: 19 Nov 1999 00:32:48 GMT
Lines: 89
Message-ID: <8125rg$m5f$1 at mochi.lava.net>
NNTP-Posting-Host: malasada.lava.net
X-Trace: mochi.lava.net 942971568 22703 199.222.42.2 (19 Nov 1999 00:32:48 GMT)
X-Complaints-To: abuse at lava.net
NNTP-Posting-Date: 19 Nov 1999 00:32:48 GMT
X-Newsreader: TIN [version 1.2 PL2]
Xref: news.lava.net news.software.nntp:55700

  I'm amazed INN hasn't run into this before.  My news server was
coming up and going down for about 6 hours til I finally tracked this
down with gdb.

  If you look at distributions, then this one could definitely bite
you; there are two careless assumptions made, one in innd.c and one in
art.c, which combine to give a probable SEGV on examining a certain
malformed Distribution: header.

  A patch to fix this for INN 2.1 is supplied below.  From quick
inspection, 2.2 appears to have the identical problem, and this same
patch would probably work.
  -- Clifton

*** art.c	1999/11/18 22:55:09	1.1
--- art.c	1999/11/18 23:05:39
***************
*** 1,4 ****
! /*  $Id: art.c,v 1.1 1999/11/18 22:55:09 cliftonr Exp $
  **
  **  Article-processing.
  */
--- 1,4 ----
! /*  $Id: art.c,v 1.2 1999/11/18 23:05:12 cliftonr Exp $
  **
  **  Article-processing.
  */
***************
*** 2253,2258 ****
--- 2253,2266 ----
      /* If we limit what distributions we get, see if we want this one. */
      p = HDR(_distribution);
      distributions = *p ? CommaSplit(p) : NULL;
+     /* CommaSplit can perfectly well return a null pointer for the first */
+     if (distributions && !distributions[0]) {
+ 	/* They just blew INN's next assumption out of the water... */
+ 	DISPOSE(distributions);
+ 	/* Treat an article with a null first distribution entry (e.g.
+ 	"Distribution: ,") as if it had no distribution line. */
+ 	distributions = NULL;
+ 	}
      if (distributions) {
  	DISTparse(distributions, &Data);
  	if (ME.Distributions
*** innd.c	1999/11/18 22:51:27	1.1
--- innd.c	1999/11/18 22:54:42
***************
*** 1,4 ****
! /*  $Id: innd.c,v 1.1 1999/11/18 22:51:27 cliftonr Exp $
  **
  **  Variable definitions, miscellany, and main().
  */
--- 1,4 ----
! /*  $Id: innd.c,v 1.2 1999/11/18 22:54:23 cliftonr Exp $
  **
  **  Variable definitions, miscellany, and main().
  */
***************
*** 124,129 ****
--- 124,131 ----
  **  Return a short name that won't overrun our bufer or syslog's buffer.
  **  q should either be p, or point into p where the "interesting" part is.
  */
+ const char *NULL_STRING = "";
+ 
  char *
  MaxLength(p, q)
      char		*p;
***************
*** 132,137 ****
--- 134,142 ----
      static char		buff[80];
      register int	i;
  
+     if (NULL == p)
+ 	/* Uh-oh! */
+ 	return NULL_STRING;
      /* Already short enough? */
      i = strlen(p);
      if (i < sizeof buff - 1)


--
 Clifton Royston  --  LavaNet Systems Architect --  cliftonr at lava.net
        "An absolute monarch would be absolutely wise and good.  
           But no man is strong enough to have no interest.  
             Therefore the best king would be Pure Chance.  
              It is Pure Chance that rules the Universe; 
          therefore, and only therefore, life is good." - AC

--
 Clifton Royston  --  LavaNet Systems Architect --  cliftonr at lava.net
        "An absolute monarch would be absolutely wise and good.  
           But no man is strong enough to have no interest.  
             Therefore the best king would be Pure Chance.  
              It is Pure Chance that rules the Universe; 
          therefore, and only therefore, life is good." - AC


More information about the inn-bugs mailing list