From 2f7e6aff2af01a2ac0003dab0c19309da2bfc3dc Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Sat, 15 Aug 2020 09:39:51 +0200 Subject: usb-linux: Use sizeof() rather than a number --- pcap-usb-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.1