Fix a possible NULL-pointer dereference on the pfsync(4) reconfiguration.

Reported by:	Eugene M. Zheganin
This commit is contained in:
Andrey V. Elsukov 2013-07-29 13:17:18 +00:00
parent 18f8f46e9f
commit 415077bad9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253769

View file

@ -1324,7 +1324,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
else if ((sifp = ifunit_ref(pfsyncr.pfsyncr_syncdev)) == NULL)
return (EINVAL);
if (pfsyncr.pfsyncr_syncpeer.s_addr == 0 && sifp != NULL)
if (sifp != NULL && (
pfsyncr.pfsyncr_syncpeer.s_addr == 0 ||
pfsyncr.pfsyncr_syncpeer.s_addr ==
htonl(INADDR_PFSYNC_GROUP)))
mship = malloc((sizeof(struct in_multi *) *
IP_MIN_MEMBERSHIPS), M_PFSYNC, M_WAITOK | M_ZERO);