Merge pull request #2476 from pacovn/Coverity_1433544_Explicit_null_dereferenced

bgpd: null check (Coverity 1433544, 1433543, 1433542)
This commit is contained in:
Lou Berger 2018-06-18 16:59:26 -04:00 committed by GitHub
commit ed892e530d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -1733,7 +1733,8 @@ void rfapiPrintMatchingDescriptors(struct vty *vty, struct prefix *vn_prefix,
int rfapiCliGetPrefixAddr(struct vty *vty, const char *str, struct prefix *p)
{
if (!str2prefix(str, p)) {
vty_out(vty, "Malformed address \"%s\"%s", str, HVTYNL);
vty_out(vty, "Malformed address \"%s\"%s", str ? str : "null",
HVTYNL);
return CMD_WARNING;
}
switch (p->family) {

View File

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