🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #2469

Re: Trn/INN bombing out during 'XHDR xref'...

#2469
From: Wayne Davison
Date: Thu, 17 Mar 1994 22:53
51 lines
2693 bytes
According to Richard P. Bainter <pug@arlut.utexas.edu>:
>   Well it appears that the problem has been solved. It seems to be a
>   buffer overflow in trn, although I haven't had a chance to test the
>   patch for it yet. I don't see any reason why it wouldn't work.

Richard has since gotten back to me that the patch does indeed work.  I'll
include it here in case anyone else in running into this same problem.  The
line numbers below will be off by a few lines, but don't worry about that.
See the end of the INSTALL file if you run into trouble applying this patch.
-- 
Wayne Davison
davison@borland.com
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index:head.c
@@ -378,18 +382,22 @@
 	nntp_command(ser_line);
 	if (nntp_check(TRUE) == NNTP_CLASS_OK) {
+	    char *line, *last_buf = ser_line;
+	    MEM_SIZE last_buflen = sizeof ser_line;
 	    for (ap = find_article(artnum); ; ) {
-		nntp_gets(ser_line, sizeof ser_line);
+		line = nntp_get_a_line(last_buf, last_buflen);
 # ifdef DEBUG
 		if (debug & DEB_NNTP)
-		    printf("<%s\n", ser_line) FLUSH;
+		    printf("<%s\n", line) FLUSH;
 # endif
-		if (NNTP_LIST_END(ser_line))
+		if (NNTP_LIST_END(line))
 		    break;
-		if ((t = index(ser_line, '\r')) != Nullch)
+		last_buf = line;
+		last_buflen = buflen_last_line_got;
+		if ((t = index(line, '\r')) != Nullch)
 		    *t = '\0';
-		if (!(t = index(ser_line, ' ')))
+		if (!(t = index(line, ' ')))
 		    continue;
 		t++;
-		num = atol(ser_line);
+		num = atol(line);
 		if (num < artnum || num > lastnum)
 		    continue;
@@ -403,4 +411,6 @@
 		    safecat(s,t,size);
 	    }
+	    if (last_buf != ser_line)
+		free(last_buf);
 	} else {
 	    fprintf(stderr,"\nUnexpected close of server socket.\n");
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Technical Details
Message-ID: <CMtzL2.B8v@borland.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!netnews.upenn.edu!news.amherst.edu!nic.umass.edu!noc.near.net!MathWorks.Com!europa.eng.gtefsd.com!emory!news-feed-2.peachnet.edu!concert!decwrl!borland.com!davison
References: <2ma0l2$fo4@ns1.arlut.utexas.edu> <2maa66$ifg@ns1.arlut.utexas.edu>

Show Full Headers
Complete Article Headers
Message-ID: <CMtzL2.B8v@borland.com>
Subject: Re: Trn/INN bombing out during 'XHDR xref'...
Date: Thu, 17 Mar 1994 22:53:25 GMT
From: davison@borland.com (Wayne Davison)
References: <2ma0l2$fo4@ns1.arlut.utexas.edu> <2maa66$ifg@ns1.arlut.utexas.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!netnews.upenn.edu!news.amherst.edu!nic.umass.edu!noc.near.net!MathWorks.Com!europa.eng.gtefsd.com!emory!news-feed-2.peachnet.edu!concert!decwrl!borland.com!davison
Newsgroups: news.software.readers,news.software.nntp
Organization: Borland International
Distribution: inet
Lines: 51