diff options
-rw-r--r-- | bgpd/bgp_vty.c | 3 | ||||
-rw-r--r-- | lib/csv.c | 2 | ||||
-rw-r--r-- | nhrpd/linux.c | 3 | ||||
-rw-r--r-- | tools/start-stop-daemon.c | 6 | ||||
-rw-r--r-- | zebra/zebra_netns_notify.c | 2 | ||||
-rw-r--r-- | zebra/zebra_pbr.c | 4 |
6 files changed, 11 insertions, 9 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8e1913a8d..b7a7d2c38 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -9860,7 +9860,8 @@ static void bgp_show_peer_gr_status(struct vty *vty, struct peer *p, { char buf[SU_ADDRSTRLEN] = {0}; char dn_flag[2] = {0}; - char neighborAddr[INET6_ADDRSTRLEN] = {0}; + /* '*' + v6 address of neighbor */ + char neighborAddr[INET6_ADDRSTRLEN + 1] = {0}; if (!p->conf_if && peer_dynamic_neighbor(p)) dn_flag[0] = '*'; @@ -637,7 +637,7 @@ void csv_dump(csv_t *csv) static int get_memory_usage(pid_t pid) { int fd, data, stack; - char buf[4096], status_child[BUFSIZ]; + char buf[4096], status_child[PATH_MAX]; char *vm; snprintf(status_child, sizeof(status_child), "/proc/%d/status", pid); diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 74aec155f..59c82b1c5 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -25,6 +25,7 @@ #include <linux/ip.h> #include <linux/if_arp.h> #include <linux/if_tunnel.h> +#include <linux/limits.h> #include "nhrp_protocol.h" #include "os.h" @@ -127,7 +128,7 @@ static int linux_configure_arp(const char *iface, int on) static int linux_icmp_redirect_off(const char *iface) { - char fname[256]; + char fname[PATH_MAX]; int fd, ret = -1; snprintf(fname, sizeof(fname), diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index ba40a02f5..7ad2a8450 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -605,7 +605,7 @@ static void parse_options(int argc, char *const *argv) static int pid_is_exec(pid_t pid, const struct stat *esb) { struct stat sb; - char buf[32]; + char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "/proc/%ld/exe", (long)pid); if (stat(buf, &sb) != 0) @@ -617,7 +617,7 @@ static int pid_is_exec(pid_t pid, const struct stat *esb) static int pid_is_user(pid_t pid, uid_t uid) { struct stat sb; - char buf[32]; + char buf[PATH_MAX]; snprintf(buf, sizeof(buf), "/proc/%ld", (long)pid); if (stat(buf, &sb) != 0) @@ -628,7 +628,7 @@ static int pid_is_user(pid_t pid, uid_t uid) static int pid_is_cmd(pid_t pid, const char *name) { - char buf[32]; + char buf[PATH_MAX]; FILE *f; int c; 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, |