summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 20:28:39 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2020-04-21 01:14:33 +0200
commit2b7165e76f78b4b92e7ec09de26d96c3e0c5849f (patch)
tree8835752ea32b4c6b2c2900749b5992cb8f1785b7 /zebra
parent*: manually remove some more sprintf (diff)
downloadfrr-2b7165e76f78b4b92e7ec09de26d96c3e0c5849f.tar.xz
frr-2b7165e76f78b4b92e7ec09de26d96c3e0c5849f.zip
*: use appropriate buffer sizes, specifiers
- Fix 1 byte overflow when showing GR info in bgpd - Use PATH_MAX for path buffers - Use unsigned specifiers for uint16_t's in zebra pbr Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_netns_notify.c2
-rw-r--r--zebra/zebra_pbr.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
index 2e0f9cd3f..c5d11f183 100644
--- a/zebra/zebra_netns_notify.c
+++ b/zebra/zebra_netns_notify.c
@@ -153,7 +153,7 @@ static int zebra_ns_delete(char *name)
static int zebra_ns_notify_self_identify(struct stat *netst)
{
- char net_path[64];
+ char net_path[PATH_MAX];
int netns;
snprintf(net_path, sizeof(net_path), "/proc/self/ns/net");
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index a53363f08..62cbcbda4 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -877,14 +877,14 @@ static void zebra_pbr_display_icmp(struct vty *vty,
/* range icmp type */
if (zpie->src_port_max || zpie->dst_port_max) {
- vty_out(vty, ":icmp:[type <%d:%d>;code <%d:%d>",
+ vty_out(vty, ":icmp:[type <%u:%u>;code <%u:%u>",
zpie->src_port_min, zpie->src_port_max,
zpie->dst_port_min, zpie->dst_port_max);
} else {
port = ((zpie->src_port_min << 8) & 0xff00) +
(zpie->dst_port_min & 0xff);
memset(decoded_str, 0, sizeof(decoded_str));
- snprintf(decoded_str, sizeof(decoded_str), "%d/%d",
+ snprintf(decoded_str, sizeof(decoded_str), "%u/%u",
zpie->src_port_min, zpie->dst_port_min);
vty_out(vty, ":icmp:%s",
lookup_msg(icmp_typecode_str,