examples: Fix format-truncation on debug
authorVictor Toso <me@victortoso.com>
Tue, 7 Aug 2018 07:45:58 +0000 (09:45 +0200)
committerNathan Hjelm <hjelmn@lanl.gov>
Wed, 5 Dec 2018 17:13:08 +0000 (10:13 -0700)
commitfcf9a53595882149ebe3adfe833cd6ade2ce7e31
treeb635c1a61ae0a3c670d5da7a07151b95c17b6da8
parente8e80368b78238ea36b378cd37e94140fec29dc7
examples: Fix format-truncation on debug

As description is used only for debug, we can extend it to be sure to
fit 256 from string variable plus 3 chars from " - " as described in
gcc warning below

 | testlibusb.c: In function ‘print_device.constprop’:
 | testlibusb.c:188:51: warning: ‘ - ’ directive output may be truncated writing 3 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
 |      snprintf(description, sizeof(description), "%s - ", string);
 |                                                    ^~~
 | testlibusb.c:188:5: note: ‘snprintf’ output between 4 and 259 bytes into a destination of size 256
 |      snprintf(description, sizeof(description), "%s - ", string);
 |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes #460

Signed-off-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
examples/testlibusb.c
libusb/version_nano.h