🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90355

Re: INN 2.7.1 Compile warning in cnfs.c

#90355
From: Julien ÉLIE
Date: Sun, 14 May 2023 19:44
37 lines
2697 bytes
Hi Jesse,

> Spinning up a new server to convert tradspool to CNFS and notice the following
> compile time warning when building INN 2.7.1. I do not recall seeing this when
> building 2.7.0 (but it's been awhile).
>
> Warning exhibited:
> 
> cnfs/cnfs.c:814:13: warning: 'strncpy' specified bound 16 equals destination
> size [-Wstringop-truncation]
>    814 |             strncpy(cycbuff->metaname, metacycbuff->name, CNFSNASIZ);
>        |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This specific warning should have been ignored, and not triggered by 
your gcc 12.2.0.  At least, there is no reason why it was not seen in 
INN 2.7.0, which similarly has it ignored.  (Unless of course __GNUC__ 
is no longer set in this version from FreeBSD.)


#if __GNUC__ > 7
#    pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
        /* Don't use sprintf() or strlcat() directly...
         * The terminating '\0' causes grief. */
        strncpy(cycbuff->metaname, metacycbuff->name, CNFSNASIZ);


The code works fine so you should not worry about it.

There are some diagnostics ignored sometimes in the source code, but 
that's OK.  (A rewrite of such parts of code is welcome of course to get 
rid of the warning.  In this case, probably switching to use memcpy().)

-- 
Julien ÉLIE

« Il n'y a que le premier pas qui coûte. » (Mme du Deffand)
Technical Details
Message-ID: <u3rdnh$ji7a$2@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <u3mifn$1mpp$1@nnrp.usenet.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Message-ID: <u3rdnh$ji7a$2@news.trigofacile.com>
Subject: Re: INN 2.7.1 Compile warning in cnfs.c
Date: Sun, 14 May 2023 21:44:49 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <u3mifn$1mpp$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: Groupes francophones par TrigoFACILE
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 14 May 2023 19:44:49 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="176.143-2-105.abo.bbox.fr:176.143.2.105"; logging-data="641258"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1
Cancel-Lock: sha1:TRoT4k/zUMPJrFUYnYkeY8WyQnU= sha256:vde78ax9OfW8plq2sH263m4XBcgBYFdMiOXj9VzHHKM= sha1:VuWGRo/YMr8KYoO3+OctnrR4Ick= sha256:ONksfdKaNf9Q3oi6sTpaNvtEXcDPxZO6pWMQN0bjlYU=
In-Reply-To: <u3mifn$1mpp$1@nnrp.usenet.blueworldhosting.com>