From: lyq140 <34637052+lyq140@users.noreply.github.com> Date: Wed, 1 Aug 2018 04:03:24 +0000 (+0800) Subject: ripd: null check the key string X-Git-Tag: frr-6.1-dev~116^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e65e227f28bf274abf4b46f656c0cb94e7428560;p=matthieu%2Ffrr.git 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> --- 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);