summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2018-06-18 16:59:26 -0400
committerGitHub <noreply@github.com>2018-06-18 16:59:26 -0400
commited892e530d2d20706973759fa81a90041d82b466 (patch)
treef8059632b0b9c7291d37a39f400d2b4cf029811d /lib/prefix.c
parentb5e3687b1d069f49aa8379b7135795699df1653b (diff)
parentc37a11ad7206344de898f09a156ee6682499dde6 (diff)
Merge pull request #2476 from pacovn/Coverity_1433544_Explicit_null_dereferenced
bgpd: null check (Coverity 1433544, 1433543, 1433542)
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)