mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 01:14:48 +00:00
*: 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>
This commit is contained in:
parent
fc746f1c01
commit
2b7165e76f
@ -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);
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user