]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use a sizeof() in bgp_rt_prefix_print(). [skip ci]
authorDenis Ovsienko <[email protected]>
Wed, 24 Nov 2021 15:08:00 +0000 (15:08 +0000)
committerDenis Ovsienko <[email protected]>
Wed, 24 Nov 2021 15:08:38 +0000 (15:08 +0000)
This way it is easier to see how the buffer is spent.

print-bgp.c

index 0a09d9c246b144712faad832fa548d5fbc2affa7..cf06c83732e62348292f8a3c6e85643efe2488ed 100644 (file)
@@ -915,7 +915,7 @@ bgp_rt_prefix_print(netdissect_options *ndo,
                     u_int plen)
 {
     /* allocate space for the largest possible string */
-    char rtc_prefix_in_hex[20] = "";
+    char rtc_prefix_in_hex[sizeof("0000 0000 0000 0000")] = "";
     u_int rtc_prefix_in_hex_len = 0;
     static char output[61]; /* max response string */
     /* allocate space for the largest possible string */