summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c3
1 files changed, 3 insertions, 0 deletions
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)