[master] 0fa4baead Using memcpy() in bstrcpy() confused FlexeLint, use strcpy() instead.
Poul-Henning Kamp
phk at phk.freebsd.dk
Mon Oct 21 09:11:45 UTC 2019
--------
In message <1ed5d96b-c6f3-5665-f311-23a6e369d1c5 at uplex.de>, Nils Goroll writes:
>On 21/10/2019 10:34, Poul-Henning Kamp wrote:
>> - size_t lbstrcpy =3D strlen(src) + 1; \
>> - assert(lbstrcpy <=3D sizeof dst); \
>> - memcpy(dst, src, lbstrcpy); \
>> + assert(strlen(src) + 1 <=3D sizeof (dst)); \
>> + strcpy((dst), (src)); \
>> } while (0)
>> =20
>> // TODO #define strcpy BANNED
>
>This introduces the conflict with the plan to #define ban strcpy.
Yes, but we can live with this strcpy() as protected by the assert
for now. Once it is the last one in the tree, not so much.
>Can't we find a different way to appease flexelint?
I tried, but it seems to use some heuristic for memcpy which
ignores what it learned from strlen() right above.
I didnt want to spend a lot of time on it now.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the varnish-commit
mailing list