Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2005 20:53:28 GMT
From:      soc-victor <soc-victor@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79503 for review
Message-ID:  <200507032053.j63KrSQI022167@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79503

Change 79503 by soc-victor@soc-victor_82.76.158.176 on 2005/07/03 20:53:03

	Minor fixes for the gensnmpdef tool to prevent some SIGSEGVs when no mibs specified on
	       the comamnd line.

Affected files ...

.. //depot/projects/soc2005/bsnmp/contrib/bsnmp/gensnmpdef/gensnmpdef.c#2 edit

Differences ...

==== //depot/projects/soc2005/bsnmp/contrib/bsnmp/gensnmpdef/gensnmpdef.c#2 (text+ko) ====

@@ -371,6 +371,11 @@
 	long u;
 	char *end;
 
+        if ( argc <= 1 ){
+		fprintf(stderr, usgtxt);
+		exit(0);
+	}
+	 
 	smiInit(NULL);
 
 	while ((opt = getopt(argc, argv, "c:h")) != -1)
@@ -396,6 +401,11 @@
 	argc -= optind;
 	argv += optind;
 
+        if( argc == 0 ){
+		fprintf(stderr,"No MIB specified\n");
+		exit(0);
+	}
+	
 	flags = smiGetFlags();
 	flags |= SMI_FLAG_ERRORS;
 	smiSetFlags(flags);
@@ -424,6 +434,10 @@
 				break;
 		}
 	}
-	level = close_node(last->oidlen - 1, level - 1);
+	if( last != NULL ){
+		level = close_node(last->oidlen - 1, level - 1);
+	}
+	
+	free(mods);	
 	return (0);
 }



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