Dave Shield wrote:
> I'm not sure that this patch is quite right.
>
> Most of the uses of NETSNMP_LOOKUP (in mibII/*.c) don't check the
> return value at all. So the code looks something like:
>
> NETSNMP_LOOKUP(x, (char *)&buf, sizeof(buf));
>
> which would expand to
>
> (0);
>
> Is that valid?
AFAIK it is. And based on my testing, the various C compilers seem to agree with
me. Without the patch the user is faced with a compile-time error, so it can't
get worse anyway.
> But there are also a couple of uses of the form
>
> if (NETSNMP_LOOKUP(....) < 0) {
> // fail
> }
>
> which this patch will (erroneously) treat as success.
There are exactly three of them, all in mibII/ipv6.c:
devbox# grep -r NETSNMP_KLOOKUP . | grep '<'
./agent/mibgroup/mibII/ipv6.c: if (NETSNMP_KLOOKUP(p, (char *) &in6pcb,
sizeof(in6pcb)) < 0) {
./agent/mibgroup/mibII/ipv6.c: if (NETSNMP_KLOOKUP(p, (char *) &in6pcb,
sizeof(in6pcb)) < 0) {
./agent/mibgroup/mibII/ipv6.c: if (NETSNMP_KLOOKUP(p, (char *) &in6pcb,
sizeof(in6pcb)) < 0) {
I'm sorry to say that this has always been broken code since klookup will never
return anything else than 0 or 1, so the above condition will *never* be met. My
patch has no impact on this. Also, keep in mind that mibII/ipv6 won't even
compile on any of the systems that would potentially make use of
--without-kmem-usage.
Does this meet your objections?
+Thomas
--
Thomas Anders (thomas.anders at blue-cable.de)
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders