Article View: news.software.nntp
Article #41640Patch for Distribution header problem
From: Clifton Royston
Date: Fri, 19 Nov 1999 00:00
Date: Fri, 19 Nov 1999 00:00
91 lines
3512 bytes
3512 bytes
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@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
Technical Details
Message-ID:
<8125rg$m5f$1@mochi.lava.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <8125rg$m5f$1@mochi.lava.net> Subject: Patch for Distribution header problem Date: Fri, 19 Nov 1999 00:00:00 +0000 From: cliftonr@lava.net (Clifton Royston) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 550337674 X-Trace: mochi.lava.net 942971568 22703 199.222.42.2 (19 Nov 1999 00:32:48 GMT) NNTP-Posting-Date: 19 Nov 1999 00:32:48 GMT Newsgroups: news.software.nntp X-Complaints-To: abuse@lava.net