bahamut icon indicating copy to clipboard operation
bahamut copied to clipboard

-Wstrncat-size warnings

Open ryandesign opened this issue 2 years ago • 0 comments

This warning appears when compiling with a modern Clang compiler:

send.c:1442:32: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
        strncat(nbuf, pattern, sizeof(nbuf) - strlen(nbuf));
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
send.c:1442:32: note: change the argument to be the free space in the destination buffer minus the terminating null byte
        strncat(nbuf, pattern, sizeof(nbuf) - strlen(nbuf));
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                               sizeof(nbuf) - strlen(nbuf) - 1

ryandesign avatar Jul 06 '23 20:07 ryandesign