bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH unionfs 3/3] Don't use strncat() with length derived from sou


From: Samuel Thibault
Subject: Re: [PATCH unionfs 3/3] Don't use strncat() with length derived from source string
Date: Tue, 27 Apr 2021 18:45:30 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Sergey Bugaev, le mar. 27 avril 2021 11:57:03 +0300, a ecrit:
> lib.c:154:3: warning: ‘strncpy’ specified bound depends on the length
> of the source argument [-Wstringop-overflow=]

> It is my understanding, based on
> https://gcc.gnu.org/bugzilla//show_bug.cgi?id=88059, that GCC does not
> do any sophisticated analysis here, and just warns about any case
> where the specified length depends on the source size.

Ok, that's why pasting the actual warning helps us understand what it's
all about.

The case in make_filepath is odd actually. Passing length to strncpy,
rather than relying on knowing that it's the proper size and use strcpy,
would seem better to me. But then we have strncat, to which it's just
the strlen(filename) that is passed, which is basically useless, and
actually defeats the check done just above.

I thus pushed your patch, thanks!

Samuel



reply via email to

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