summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/rfapi/rfapi_vty.c3
-rw-r--r--lib/prefix.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index ccaa472092..18a979e531 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -1733,7 +1733,8 @@ void rfapiPrintMatchingDescriptors(struct vty *vty, struct prefix *vn_prefix,
int rfapiCliGetPrefixAddr(struct vty *vty, const char *str, struct prefix *p)
{
if (!str2prefix(str, p)) {
- vty_out(vty, "Malformed address \"%s\"%s", str, HVTYNL);
+ vty_out(vty, "Malformed address \"%s\"%s", str ? str : "null",
+ HVTYNL);
return CMD_WARNING;
}
switch (p->family) {
diff --git a/lib/prefix.c b/lib/prefix.c
index ed0774e774..b129665e7b 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -1197,6 +1197,9 @@ int str2prefix(const char *str, struct prefix *p)
{
int ret;
+ if (!str || !p)
+ return 0;
+
/* First we try to convert string to struct prefix_ipv4. */
ret = str2prefix_ipv4(str, (struct prefix_ipv4 *)p);
if (ret)