[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [platform-testers] texinfo-6.6.90 pretest

From: Hans-Bernhard Bröker
Subject: Re: [platform-testers] texinfo-6.6.90 pretest
Date: Tue, 20 Aug 2019 02:29:23 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Am 19.08.2019 um 22:35 schrieb Bruno Haible:
> Eli Zaretskii wrote:
>> One other issue is that GCC 8 flags many uses of strncat in
>> install-info.c as unsafe:
>>      install-info.c: In function 'split_entry':
>>      install-info.c:1624:17: warning: 'strncat' specified bound 2 equals 
>> source length [-Wstringop-overflow=]
>>                       strncat (*description, "  ", 2);
>>                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> The warnings are clearly pointless, because the amount of memory
> allocated for *description is unknown to the compiler.

I disagree here.  There is indeed something fishy here, but the warning
is quite definitely not pointless.

*) The warning is explicitly about the _source_ buffere size, not that
of the destination, so whether or not GCC can know the size of
*description here is irrelevant.

*) The warning is not entirely unjustified, because the above code is,
at the least, somewhat misleading.  The actual number of characters this
will add to the output is not 2, as it appears to say right there in the
argument list, but 3 (because strncat insists on writing a closing '\0').

*) IMHO there must be something wrong with that GCC: the text of the
warning mismatches the indicated -W option.  This warning is
-Wstringop-truncation, not -Wstringop-overflow

reply via email to

[Prev in Thread] Current Thread [Next in Thread]