diff options
author | Victor Toso <me@victortoso.com> | 2018-08-07 09:45:58 +0200 |
---|---|---|
committer | Nathan Hjelm <hjelmn@lanl.gov> | 2018-12-05 10:13:08 -0700 |
commit | fcf9a53595882149ebe3adfe833cd6ade2ce7e31 (patch) | |
tree | b635c1a61ae0a3c670d5da7a07151b95c17b6da8 | |
parent | e8e80368b78238ea36b378cd37e94140fec29dc7 (diff) | |
download | libusb-fcf9a53595882149ebe3adfe833cd6ade2ce7e31.tar.gz |
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>
-rwxr-xr-x | examples/testlibusb.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/testlibusb.c b/examples/testlibusb.c index f844aaf..6501a12 100755 --- a/examples/testlibusb.c +++ b/examples/testlibusb.c @@ -169,7 +169,7 @@ static int print_device(libusb_device *dev, int level) { struct libusb_device_descriptor desc; libusb_device_handle *handle = NULL; - char description[256]; + char description[260]; char string[256]; int ret; uint8_t i; diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 7679437..0ffedb5 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11323 +#define LIBUSB_NANO 11324 |