Synth/WatchPoint: fix gcc compiler warnings and a possible string overflow
commitccea566a91c55d437b1475363b9cf5ab83a93536
authorJulien Olivain <ju.o@free.fr>
Fri, 31 Dec 2021 12:08:43 +0000 (31 13:08 +0100)
committerMark McCurry <mark.d.mccurry@gmail.com>
Fri, 31 Dec 2021 16:44:17 +0000 (31 11:44 -0500)
treead45221cf1d8e8368cb489066dbb0eb60ad4582e
parentcd41eac2ae76cdd9aeba7a2d47d2c7b1473f0937
Synth/WatchPoint: fix gcc compiler warnings and a possible string overflow

strncat() is used passing the destination length without substracting one byte
for the terminating null byte.

This commit fixes the warning:

    src/Synth/WatchPoint.cpp: In constructor ‘zyn::WatchPoint::WatchPoint(zyn::WatchManager*, const char*, const char*)’:
    src/Synth/WatchPoint.cpp:36:16: warning: ‘char* strncat(char*, const char*, size_t)’ specified bound 128 equals destination size [-Wstringop-truncation]
       36 |         strncat(identity, id, sizeof(identity));
          |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/Synth/WatchPoint.cpp:36:16: warning: ‘char* strncat(char*, const char*, size_t)’ specified bound 128 equals destination size [-Wstringop-overflow=]

Note: this warning is reported by gcc 11.2.1, on Fedora 35.

Signed-off-by: Julien Olivain <ju.o@free.fr>
src/Synth/WatchPoint.cpp