Merge pull request #2766 from lyq140/branch1

ripd: null check key
This commit is contained in:
Donald Sharp 2018-08-01 10:42:52 -04:00 committed by GitHub
commit 037f162fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -828,7 +828,7 @@ static int rip_auth_simple_password(struct rte *rte, struct sockaddr_in *from,
struct key *key;
keychain = keychain_lookup(ri->key_chain);
if (keychain == NULL)
if (keychain == NULL || keychain->key == NULL)
return 0;
key = key_match_for_accept(keychain, auth_str);