summaryrefslogtreecommitdiffstats
path: root/lib/keychain.c
diff options
context:
space:
mode:
authorlyq140 <34637052+lyq140@users.noreply.github.com>2018-08-01 14:48:36 +0200
committerlyq140 <34637052+lyq140@users.noreply.github.com>2018-08-01 14:48:36 +0200
commitc4efb22479a17f5298baceb299975c5e198c4b53 (patch)
treef0b53f5d82116d5da3548b918a53657b202b178d /lib/keychain.c
parentMerge pull request #2763 from lyq140/master (diff)
downloadfrr-c4efb22479a17f5298baceb299975c5e198c4b53.tar.xz
frr-c4efb22479a17f5298baceb299975c5e198c4b53.zip
ripd: null check key
Fix ripd crash of null pointer. when authenticate a rip packet, the key pointer or the key string pointer may be null, the code have to return then. Signed-off-by: lyq140 <34637052+lyq140@users.noreply.github.com>
Diffstat (limited to 'lib/keychain.c')
-rw-r--r--lib/keychain.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/keychain.c b/lib/keychain.c
index c3e1a6d3c..494f6f643 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -172,7 +172,7 @@ struct key *key_match_for_accept(const struct keychain *keychain,
if (key->accept.start == 0
|| (key->accept.start <= now
&& (key->accept.end >= now || key->accept.end == -1)))
- if (strncmp(key->string, auth_str, 16) == 0)
+ if (key->string && (strncmp(key->string, auth_str, 16) == 0))
return key;
}
return NULL;