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>
This commit is contained in:
parent
e8e80368b7
commit
fcf9a53595
2 changed files with 2 additions and 2 deletions
|
@ -169,7 +169,7 @@ static int print_device(libusb_device *dev, int level)
|
||||||
{
|
{
|
||||||
struct libusb_device_descriptor desc;
|
struct libusb_device_descriptor desc;
|
||||||
libusb_device_handle *handle = NULL;
|
libusb_device_handle *handle = NULL;
|
||||||
char description[256];
|
char description[260];
|
||||||
char string[256];
|
char string[256];
|
||||||
int ret;
|
int ret;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define LIBUSB_NANO 11323
|
#define LIBUSB_NANO 11324
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue