summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-01-11 11:15:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-01-11 11:15:04 +0000
commit0b9af9a09331ed976b612efb703198dc72842179 (patch)
treef4779c904dc4546204df742edd0cda52230091ca
parent83e571a245cd43ec24e49d7ff14c646785d57ea4 (diff)
Do not use after free kif->if_index; discovered with claudio
ok dlg
-rw-r--r--usr.sbin/snmpd/mib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index 3958b0c48f0..fb8e61cf71b 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.33 2010/01/11 06:38:41 deraadt Exp $ */
+/* $OpenBSD: mib.c,v 1.34 2010/01/11 11:15:03 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -881,11 +881,12 @@ mib_ifget(u_int idx)
if (kif == NULL)
return (NULL);
}
+ idx = kif->if_index;
/* Update interface information */
- kr_updateif(kif->if_index);
- if ((kif = kr_getif(kif->if_index)) == NULL) {
- log_debug("mib_ifxtable: interface disappeared?");
+ kr_updateif(idx);
+ if ((kif = kr_getif(idx)) == NULL) {
+ log_debug("mib_ifxtable: interface %d disappeared?", idx);
return (NULL);
}