https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96916
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID CC| |msebor at gcc dot gnu.org --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Yes, the warning is by design and is issued for any built-in function that takes an argument specifying the size of an object (malloc, memcpy, etc.). It's meant to help identify calls to allocation functions that are certain to fail or that will overflow the destination. Passing in PTRDIFF_MAX instead should avoid the warning (as would of course calling strdup).