SF.net SVN: nagiosplug:[2171] nagiosplug/trunk/plugins/check_snmp.c

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2171
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2171&view=rev
Author:   dermoth
Date:     2009-03-18 07:54:15 +0000 (Wed, 18 Mar 2009)

Log Message:
-----------
check_snmp: Fix potential buffer overflow - enforce MAX_OIDS limit (John A. Barbuto)

From: Thomas Guyot-Sionnest <[email protected]>

Modified Paths:
--------------
    nagiosplug/trunk/plugins/check_snmp.c

Modified: nagiosplug/trunk/plugins/check_snmp.c
===================================================================
--- nagiosplug/trunk/plugins/check_snmp.c	2009-03-18 07:39:26 UTC (rev 2170)
+++ nagiosplug/trunk/plugins/check_snmp.c	2009-03-18 07:54:15 UTC (rev 2171)
@@ -527,9 +527,8 @@
 					needmibs = TRUE;
 			}
 			oids = calloc(MAX_OIDS, sizeof (char *));
-			for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", ")) {
+			for (ptr = strtok(optarg, ", "); ptr != NULL && j < MAX_OIDS; ptr = strtok(NULL, ", "), j++) {
 				oids[j] = strdup(ptr);
-				j++;
 			}
 			numoids = j;
 			if (c == 'E' || c == 'e') {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.