Menu

#673 parse_miboid

windows
closed
nobody
library (262)
5
2012-11-08
2003-02-21
Anonymous
No

I have downloaded net-snmp 5.0.7 and am using it
under Windows NT (Visual C++ 6.0), and I was
getting odd results from parse_miboid.
parse_miboid("1.3.6.1.4.1", myoid); correctly
returned 6, parse_miboid("1.3.6.1.4.1.123",
myoid); correctly returned 7 but if I put the string
into a char array, it returned 8.
I think the problem is in the line:-
while (isdigit(*buf++));
which finds that the null pointer is not a number,
then moves onto the next character. For string
constants this seems OK as there appear to be at
least 2 NULL characters, but not for char []
An easy fix is to change *buf++ to *++buf as we
are guaenteed that the current pointer is on a digit

roger.lowes@astrium-space.com

Discussion


Log in to post a comment.