I think I have figured out why you are skeptical about the patch I previously submitted. I have seen a case where it fails. I wish to propose this new patch.

--- snmp_orig/net-snmp-5.2.3/snmplib/mib.c	2006-01-25 09:28:11.000000000 -0700
+++ snmp/net-snmp-5.2.3/snmplib/mib.c	2006-09-29 15:02:49.000000000 -0600
@@ -5152,12 +5152,22 @@
             if (check && tp->ranges) {
                 struct range_list *rp = tp->ranges;
                 int             ok = 0;
-                while (!ok && rp)
-                    if ((rp->low <= (int) subid)
-                        && ((int) subid <= rp->high))
-                        ok = 1;
-                    else
-                        rp = rp->next;
+                if (tp->type == TYPE_INTEGER
+                        || tp->type == TYPE_INTEGER32) {
+                    while (!ok && rp)
+                        if ((rp->low <= (int) subid)
+                            && ((int) subid <= rp->high))
+                            ok = 1;
+                        else
+                            rp = rp->next;
+                } else {
+                    while (!ok && rp)
+                        if (((unsigned int) rp->low <= subid)
+                            && (subid <= (unsigned int) rp->high))
+                            ok = 1;
+                        else
+                            rp = rp->next;
+                }
                 if (!ok)
                     goto bad_id;
             }

Reply via email to