Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2017 06:13:28 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311757 - head/contrib/bsnmp/gensnmpdef
Message-ID:  <201701090613.v096DSp3012400@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Jan  9 06:13:27 2017
New Revision: 311757
URL: https://svnweb.freebsd.org/changeset/base/311757

Log:
  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

Modified:
  head/contrib/bsnmp/gensnmpdef/gensnmpdef.c

Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.c
==============================================================================
--- head/contrib/bsnmp/gensnmpdef/gensnmpdef.c	Mon Jan  9 06:07:44 2017	(r311756)
+++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.c	Mon Jan  9 06:13:27 2017	(r311757)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701090613.v096DSp3012400>