svn commit: r311467 - stable/11/contrib/bsnmp/snmp_mibII
Ngie Cooper
ngie at FreeBSD.org
Fri Jan 6 03:54:27 UTC 2017
Author: ngie
Date: Fri Jan 6 03:54:26 2017
New Revision: 311467
URL: https://svnweb.freebsd.org/changeset/base/311467
Log:
MFC r310873:
Guard against use-after-free after calling mibif_free(..)
Set variables to NULL after calling free.
Also, remove unnecessary if (x != NULL) checks before calling free(x)
Modified:
stable/11/contrib/bsnmp/snmp_mibII/mibII.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/contrib/bsnmp/snmp_mibII/mibII.c
==============================================================================
--- stable/11/contrib/bsnmp/snmp_mibII/mibII.c Fri Jan 6 03:53:44 2017 (r311466)
+++ stable/11/contrib/bsnmp/snmp_mibII/mibII.c Fri Jan 6 03:54:26 2017 (r311467)
@@ -707,10 +707,11 @@ mibif_free(struct mibif *ifp)
}
free(ifp->private);
- if (ifp->physaddr != NULL)
- free(ifp->physaddr);
- if (ifp->specmib != NULL)
- free(ifp->specmib);
+ ifp->private = NULL;
+ free(ifp->physaddr);
+ ifp->physaddr = NULL;
+ free(ifp->specmib);
+ ifp->specmib = NULL;
STAILQ_FOREACH(map, &mibindexmap_list, link)
if (map->mibif == ifp) {
@@ -745,8 +746,8 @@ mibif_free(struct mibif *ifp)
at = at1;
}
-
free(ifp);
+ ifp = NULL;
mib_if_number--;
mib_iftable_last_change = this_tick;
}
More information about the svn-src-stable
mailing list