From b55d259a1472540d9bd011ea099e29ff7f94e335 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Mon, 9 Jan 2017 06:13:27 +0000 Subject: [PATCH] Similar to r311750, check for the result from smiGetModule to avoid a segfault when dereferencing a NULL pointer later on. Choose to just check for the NULL pointer in the next for-loop for now to fix the issue with a minimal amount of code churn sys/queue.h use here would make more sense than using a static table MFC after: 5 days --- contrib/bsnmp/gensnmpdef/gensnmpdef.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/bsnmp/gensnmpdef/gensnmpdef.c b/contrib/bsnmp/gensnmpdef/gensnmpdef.c index ae34b7a44cf2..b0bfdafdd7be 100644 --- a/contrib/bsnmp/gensnmpdef/gensnmpdef.c +++ b/contrib/bsnmp/gensnmpdef/gensnmpdef.c @@ -560,6 +560,8 @@ main(int argc, char *argv[]) level = 0; last = NULL; for (opt = 0; opt < argc; opt++) { + if (mods[opt] == NULL) /* smiGetModule failed above */ + continue; n = smiGetFirstNode(mods[opt], SMI_NODEKIND_ANY); if (n == NULL) continue;