🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #22317

Re: More luser "long newgroup's" issued

#22317
From: Marc Slemko
Date: Mon, 13 Oct 1997 00:00
23 lines
1653 bytes
In <61r9cm$vhb$1@news.dialnet.net> dledford@news.dialnet.net (Doug Ledford) writes:

[...]

>There are two key things to note here.  First, the check for strlen(Name) +
>strlen(Rest) being > SMBUF - 24.  Second, note that the number of characters
>added to those two strings during the snprintf() statement counts out to
>exactly 24.  This means that if strlen(Name) + strlen(Rest) == SMBUF - 24,
>then the test fails, we perform the snprintf (with no buffer overflow as
>intended), then we proceed further on.  However, since the number of
>characters added was 24, and SMBUF only had 24 characters to spare, we end
>up with no NULL terminator.  Not so bad, until two lines later when we
>set an IOVEC based upon strlen(buff).  Without the NULL terminator, and
>having already done an iovset on iov[0], we are gauranteed that the strlen
>will return a value larger than SMBUF.  We are then gauranteed to corrupt
>our active file.  Nice.

No.  snprintf() always adds a null terminator.

strncpy doesn't.

Technical Details
Message-ID: <61ror1$5di$1@scanner.worldgate.com>
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
References: <61jna5$1jv$1@earth.execpc.com> <61jp17$db8$0@207.14.113.2> <61r9cm$vhb$1@news.dialnet.net>

Show Full Headers
Complete Article Headers
Message-ID: <61ror1$5di$1@scanner.worldgate.com>
Subject: Re: More luser "long newgroup's" issued
Date: Mon, 13 Oct 1997 00:00:00 +0000
From: Marc Slemko <marcs@znep.com>
References: <61jna5$1jv$1@earth.execpc.com> <61jp17$db8$0@207.14.113.2> <61r9cm$vhb$1@news.dialnet.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-mail
X-Deja-AN: 279926582
Organization: WorldGate Inc. http://www.worldgate.com/
Newsgroups: news.software.nntp