summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_route.c12
-rw-r--r--eigrpd/eigrp_filter.c1
-rw-r--r--lib/command.c5
-rw-r--r--lib/vty.c8
-rw-r--r--ospfd/ospf_vty.c3
-rw-r--r--vtysh/vtysh.c6
-rw-r--r--zebra/zapi_msg.c2
7 files changed, 20 insertions, 17 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f84deede0d..d3c03cb722 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6962,22 +6962,22 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
inet_ntop(
AF_INET6,
&attr->mp_nexthop_global,
- buf_a, BUFSIZ));
+ buf_a, sizeof(buf_a)));
else
vty_out(vty, "%s",
inet_ntop(
AF_INET6,
&attr->mp_nexthop_global,
- buf_a, BUFSIZ));
+ buf_a, sizeof(buf_a)));
} else if (attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
if (json) {
inet_ntop(AF_INET6,
&attr->mp_nexthop_global,
- buf_a, BUFSIZ);
+ buf_a, sizeof(buf_a));
inet_ntop(AF_INET6,
&attr->mp_nexthop_local,
- buf_b, BUFSIZ);
+ buf_b, sizeof(buf_b));
sprintf(buf_c, "%s(%s)", buf_a, buf_b);
json_object_string_add(
json_out,
@@ -6987,11 +6987,11 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
inet_ntop(
AF_INET6,
&attr->mp_nexthop_global,
- buf_a, BUFSIZ),
+ buf_a, sizeof(buf_a)),
inet_ntop(
AF_INET6,
&attr->mp_nexthop_local,
- buf_b, BUFSIZ));
+ buf_b, sizeof(buf_b)));
}
}
}
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c
index 7a8fd027ca..c1bf1647d8 100644
--- a/eigrpd/eigrp_filter.c
+++ b/eigrpd/eigrp_filter.c
@@ -74,6 +74,7 @@ void eigrp_distribute_update(struct distribute *dist)
/* if no interface address is present, set list to eigrp process struct
*/
e = eigrp_lookup();
+ assert(e != NULL);
/* Check if distribute-list was set for process or interface */
if (!dist->ifname) {
diff --git a/lib/command.c b/lib/command.c
index 7df81438f2..a8e61c6bb4 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1184,7 +1184,7 @@ static int handle_pipe_action(struct vty *vty, const char *cmd_in,
char **cmd_out)
{
/* look for `|` */
- char *orig, *working, *token;
+ char *orig, *working, *token, *u;
char *pipe = strstr(cmd_in, "| ");
if (!pipe)
@@ -1213,7 +1213,8 @@ static int handle_pipe_action(struct vty *vty, const char *cmd_in,
goto fail;
}
*cmd_out = XSTRDUP(MTYPE_TMP, cmd_in);
- *(strstr(*cmd_out, "|")) = '\0';
+ u = *cmd_out;
+ strsep(&u, "|");
} else {
vty_out(vty, "%% Unknown action '%s'\n", token);
goto fail;
diff --git a/lib/vty.c b/lib/vty.c
index 2d8112727a..280b2ace51 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -120,9 +120,11 @@ bool vty_set_include(struct vty *vty, const char *regexp)
bool ret = true;
char errbuf[256];
- if (!regexp && vty->filter) {
- regfree(&vty->include);
- vty->filter = false;
+ if (!regexp) {
+ if (vty->filter) {
+ regfree(&vty->include);
+ vty->filter = false;
+ }
return true;
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 21567c6ce6..2bd9cfd495 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -8176,9 +8176,6 @@ DEFUN (ospf_redistribute_instance_source,
instance = strtoul(argv[idx_number]->arg, NULL, 10);
- if (!ospf)
- return CMD_SUCCESS;
-
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) {
vty_out(vty,
"Instance redistribution in non-instanced OSPF not allowed\n");
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index dd680cb9f4..63553469dd 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -548,8 +548,10 @@ static int vtysh_execute_func(const char *line, int pager)
line = "end";
vline = cmd_make_strvec(line);
- if (vline == NULL && vty->is_paged) {
- vty_close_pager(vty);
+
+ if (vline == NULL) {
+ if (vty->is_paged)
+ vty_close_pager(vty);
return CMD_SUCCESS;
}
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index b17bbc95c2..853a83373d 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -3061,7 +3061,7 @@ void zserv_handle_commands(struct zserv *client, struct stream *msg)
return;
}
- if (hdr.command > array_size(zserv_handlers)
+ if (hdr.command >= array_size(zserv_handlers)
|| zserv_handlers[hdr.command] == NULL)
zlog_info("Zebra received unknown command %d", hdr.command);
else