From 9376c3421ae9ccc37e51ed742c5d0bed333f8d20 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Fri, 12 May 2006 23:17:38 +0000 Subject: [lib] CID #3, fix forward-null errors in vty_prefix_list_uninstall 2006-05-12 Paul Jakma * plist.c: (vty_prefix_list_uninstall) Fix potential NULL deref of prefix and typestr strings, Coverity CID #3. --- lib/ChangeLog | 5 +++++ lib/plist.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/ChangeLog b/lib/ChangeLog index 9e6dc852..64fa8518 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2006-05-12 Paul Jakma + + * plist.c: (vty_prefix_list_uninstall) Fix potential NULL deref + of prefix and typestr strings, Coverity CID #3. + 2006-03-30 Paul Jakma * command.h: (DEFUN_CMD_FUNC_TEXT) Annotate arguments as diff --git a/lib/plist.c b/lib/plist.c index 83c5aa0c..6caece0e 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -804,6 +804,13 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, return CMD_SUCCESS; } + /* We must have, at a minimum, both the type and prefix here */ + if ((typestr == NULL) || (prefix == NULL)) + { + vty_out (vty, "%% Both prefix and type required%s", VTY_NEWLINE); + return CMD_WARNING; + } + /* Check sequence number. */ if (seq) seqnum = atoi (seq); -- cgit v1.2.1