Fix free memory corruption and off-by-on error when comparing SNMP OIDs
Both introduced by the polishing of the SNMP tree generator.
}
int i, r = 1;
- while (r <= namelen) {
+ while (r < namelen) {
/* Find the child node which matches this */
for (i = 0; i < e->children && e->leaves[i]->name[r] != name[r]; i++) ; // seek-loop
*name = NULL;
*nl = 0;
char *s = xstrdup(str);
+ char *s_ = s;
/* Parse the OID string into oid bits */
- while ( (p = strsep(&s, delim)) != NULL) {
+ while ( (p = strsep(&s_, delim)) != NULL) {
*name = (oid*)xrealloc(*name, sizeof(oid) * ((*nl) + 1));
(*name)[*nl] = atoi(p);
(*nl)++;