]> 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)
committerGuy Harris <[email protected]>
Sun, 17 Jul 2022 03:15:48 +0000 (20:15 -0700)
This way it is easier to see how the buffer is spent.

(cherry picked from commit db78c36113d827104a787fb6ac018ce9c193c07b)

print-bgp.c

index bcf7a3c4ed28bc6459a5b3c66e6d323b3a1c3df7..26798af67ff8e32887c54586f7dc3f19cc9bd1e7 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 */