summaryrefslogtreecommitdiff
path: root/ripd/ripd.c
diff options
context:
space:
mode:
authorlyq140 <34637052+lyq140@users.noreply.github.com>2018-08-01 12:03:24 +0800
committerlyq140 <34637052+lyq140@users.noreply.github.com>2018-08-01 12:03:24 +0800
commite65e227f28bf274abf4b46f656c0cb94e7428560 (patch)
tree2507cbff401ba02f9dcf097c0e872151b54e828f /ripd/ripd.c
parente841105b615c29e98fe5b753afd221d437ae0b9c (diff)
ripd: null check the key string
This fix a crash of null pointer. when we don't add a key string or delete it, the key is not null but key string is null, so the code have to return. Signed-off-by: lyq140 <34637052+lyq140@users.noreply.github.com>
Diffstat (limited to 'ripd/ripd.c')
-rw-r--r--ripd/ripd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 90dc7808eb..fa1188d625 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -902,7 +902,7 @@ static int rip_auth_md5(struct rip_packet *packet, struct sockaddr_in *from,
return 0;
key = key_lookup_for_accept(keychain, md5->keyid);
- if (key == NULL)
+ if (key == NULL || key->string == NULL)
return 0;
strncpy(auth_str, key->string, RIP_AUTH_MD5_SIZE);