summaryrefslogtreecommitdiffstats
path: root/lib/command.c
diff options
context:
space:
mode:
authorpaco <paco@voltanet.io>2018-06-11 20:14:59 +0200
committerpaco <paco@voltanet.io>2018-06-12 16:37:36 +0200
commit9f227e4c91f03d9ff801bf2ae2321cb22c91800d (patch)
treec7bb975453e11d71304d798f14878680b6bb8716 /lib/command.c
parentMerge pull request #2298 from qlyoung/pipe-actions-vtysh (diff)
downloadfrr-9f227e4c91f03d9ff801bf2ae2321cb22c91800d.tar.xz
frr-9f227e4c91f03d9ff801bf2ae2321cb22c91800d.zip
lib: null return value check (Coverity 1469894)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index 7df81438f..a8e61c6bb 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;