🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #55824

Re: Forecasting the posting's size

#55824
From: Joshua
Date: Tue, 01 Jan 2002 17:09
21 lines
1946 bytes
"Curt Welch" <curt@kcwc.com> wrote in message
news:20011230215952.153$nt@newsreader.com...

> >  }while(true);
> >   if (0<flag)
> >    return -1;    //overflow
>
> coding style issue: you null terminate the buffer below but you
> exit above without null terminating it.  That, along with other sloppy
> coding styles could lead to a core-dump when the code that calls this
> function does something stupid like a strlen() of the buffer even
> when the return value is -1.  If you null terminate the buffer normally,
> then never exit without the buffer null terminated.

Yes,you are right. But I must check the return value as soon as possible.
If -1 is found,I am very clear what is the meaning,so I will never use
strlen() or strBuf.


Technical Details
Message-ID: <a0sq1o$9r3$1@mail.cn99.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!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!news.cn99.com!not-for-mail
References: <a0mi6f$qqr$1@mail.cn99.com> <20011230161737.549$XI@newsreader.com> <a0o95h$or9$1@mail.cn99.com> <20011230215952.153$nt@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <a0sq1o$9r3$1@mail.cn99.com>
Subject: Re: Forecasting the posting's size
Date: Wed, 2 Jan 2002 01:09:08 +0800
From: "Joshua" <JoshuaIIII@hotmail.com>
References: <a0mi6f$qqr$1@mail.cn99.com> <20011230161737.549$XI@newsreader.com> <a0o95h$or9$1@mail.cn99.com> <20011230215952.153$nt@newsreader.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!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!news.cn99.com!not-for-mail
Newsgroups: news.software.nntp
Organization: Bentium Ltd. (CN99)
Lines: 20
NNTP-Posting-Host: 61.156.86.60
X-Trace: mail.cn99.com 1009904505 10083 61.156.86.60 (1 Jan 2002 17:01:45 GMT)
X-Complaints-To: usenet@news.cn99.com
NNTP-Posting-Date: Tue, 1 Jan 2002 17:01:45 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200