mib2opennms uses strcat (which adds an additional byte each time) to
build paths but only allocates strlen bytes which doesn't take the null
byte into account.

Index: mib2opennms.c
===================================================================
--- mib2opennms.c       (revision 9194)
+++ mib2opennms.c       (working copy)
@@ -238,7 +238,7 @@
     
        smiInit(NULL);
 
-       pathlen = strlen(STANDARD_PATH) + (mibpath == NULL ? 0 : 
strlen(mibpath)+1 /* for the colon */);
+       pathlen = 1 + strlen(STANDARD_PATH) + (mibpath == NULL ? 0 : 
strlen(mibpath)+1 /* for the colon */);
 
        newpath = (char *) malloc( pathlen * sizeof(char) );
        newpath[0] = '\0';

Found with valgrind. The tool still seems horribly broken on 64 bit
systems but I think that may be 32/64bit breakage inside libsmi as
mib2opennms seems to use the correct types.

-- 
Alex Bennee
Software Engineer, Cambridge Broadband


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to