]> granicus.if.org Git - php/commitdiff
Fixed bug #48359 (Script hangs on snmprealwalk if OID is not increasing)
authorIlia Alshanetsky <iliaa@php.net>
Sun, 31 May 2009 14:11:04 +0000 (14:11 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 31 May 2009 14:11:04 +0000 (14:11 +0000)
# Original patch by simonov at gmail dot com

ext/snmp/snmp.c

index 9c6c6b443ce14c3176fbbfadf85fce8c5dce64a6..7a9d8eec792ea3fd62ac7b3dab7f4e62b7002b11 100644 (file)
@@ -677,9 +677,14 @@ retry:
                                        if (st >= SNMP_CMD_WALK && st != SNMP_CMD_SET) {
                                                if (vars->type != SNMP_ENDOFMIBVIEW && 
                                                        vars->type != SNMP_NOSUCHOBJECT && vars->type != SNMP_NOSUCHINSTANCE) {
-                                                       memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid));
-                                                       name_length = vars->name_length;
-                                                       keepwalking = 1;
+                                                       if (snmp_oid_compare(name, name_length, vars->name, vars->name_length) >= 0) {
+                                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error: OID not increasing: %s",name);
+                                                               keepwalking = 0;
+                                                       } else {
+                                                               memmove((char *)name, (char *)vars->name,vars->name_length * sizeof(oid));
+                                                               name_length = vars->name_length;
+                                                               keepwalking = 1;
+                                                       }
                                                }
                                        }
                                }