From: Francois-Xavier Le Bail Date: Sat, 15 Aug 2020 07:39:51 +0000 (+0200) Subject: usb-linux: Use sizeof() rather than a number X-Git-Tag: libpcap-1.10-bp~47 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/2f7e6aff2af01a2ac0003dab0c19309da2bfc3dc usb-linux: Use sizeof() rather than a number --- diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 436a8452..9e7e8404 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -902,7 +902,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha char string_truncated[181]; strncpy(string_truncated, string, sizeof(string_truncated)); - string_truncated[180] = 0; + string_truncated[sizeof(string_truncated) - 1] = 0; snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't parse USB bus message '%s', too few tokens (expected 8 got %d)", string_truncated, ret);