Check for NULL before de-refencing; in particular sel is assigned to NULL,

in the default case, and then couple of lines down we do sel->

Approved by:	glebius (mentor)
Obtained from:	NetBSD CVS repo (r1.5)
This commit is contained in:
Cy Schubert 2014-09-22 16:45:28 +00:00
parent 66829acbb3
commit 11eb83e638

View File

@ -1134,7 +1134,7 @@ ipf_dstlist_select(fin, d)
int family;
int x;
if (d->ipld_dests == NULL || *d->ipld_dests == NULL)
if (d == NULL || d->ipld_dests == NULL || *d->ipld_dests == NULL)
return NULL;
family = fin->fin_family;
@ -1222,7 +1222,7 @@ ipf_dstlist_select(fin, d)
break;
}
if (sel->ipfd_dest.fd_addr.adf_family != family)
if (sel && sel->ipfd_dest.fd_addr.adf_family != family)
sel = NULL;
d->ipld_selected = sel;