Nevertheless... The memory that is allocated at lines 3715 and 3724 is leaked at line 3795.
Allocations: * */** ** sec_params = data;** ** pdu->contextEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE);**<---------------- FIRST ALLOCATION ** pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;** ** ** /*** ** * Note: there is no length limit on the msgAuthoritativeEngineID field,** ** * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC** ** * limit). We'll use double that here to be on the safe side. ** ** */** ** ** pdu->securityEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE * 2);**<--------------- SECOND ALLOCATION ** pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;** ** pdu->securityName = (char *) calloc(1, SNMP_MAX_SEC_NAME_SIZE);** ** pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;** * Location of leaks: * if (ret_val != SNMPERR_SUCCESS) {** ** DEBUGDUMPSECTION("recv", "ScopedPDU");** ** /*** ** * Parse as much as possible -- though I don't see the point? [jbpn]. ** ** */** ** if (cp) {** ** cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);** ** }** ** if (cp) {** ** DEBUGPRINTPDUTYPE("recv", *cp);** ** snmp_pdu_parse(pdu, cp, &pdu_buf_len);** ** DEBUGINDENTADD(-8);** ** } else {** ** DEBUGINDENTADD(-4);** ** }** ** ** SNMP_FREE(mallocbuf);** ** return ret_val;**<----------------------- TWO LEAKS OCCUR HERE ** }** * On 03/12/2014 11:06 AM, John Zavgren wrote:
Dear List:Let me apologize... the "memory leak" that I reported, IS NOT a memory leak. I should have read my email carefully before sending it.I'm sorry for any confusion or consternation I may have created. :-( JZ On 03/12/2014 10:55 AM, John Zavgren wrote:Greetings:Memory is allocated in the procedure snmv3_parse(), in the file: snmplib/snmp_api.c, at line number 3995, and leaked at line number 4004.*/*** ** * securtityParameters OCTET STRING begins after msgGlobalData ** ** */** ** sec_params = data;**** pdu->contextEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE); <----- MEMORY ALLOCATED HERE**** pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;** ** ** /***** * Note: there is no length limit on the msgAuthoritativeEngineID field,** ** * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC**** * limit). We'll use double that here to be on the safe side. ** ** */** **** pdu->securityEngineID = (u_char *) calloc(1, SNMP_MAX_ENG_SIZE * 2);<------ MEMORY LEAKED HERE**** pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;** ** pdu->securityName = (char *) calloc(1, SNMP_MAX_SEC_NAME_SIZE);** ** pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;* The fix seems obvious, just delete the first allocation?The bug is present in the 5-7.2.1 version too, but I'm not using that at the moment because it won't compile on my Ubuntu 12.04 machine:*jzavgren@SNMPTest:~/code/net-snmp-5.7.2.1$ make** **making all in /home/jzavgren/code/net-snmp-5.7.2.1/snmplib** **make[1]: Entering directory `/home/jzavgren/code/net-snmp-5.7.2.1/snmplib'** **make[1]: Leaving directory `/home/jzavgren/code/net-snmp-5.7.2.1/snmplib'** **making all in /home/jzavgren/code/net-snmp-5.7.2.1/agent** **make[1]: Entering directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent'** **making all in /home/jzavgren/code/net-snmp-5.7.2.1/agent/helpers** **make[2]: Entering directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent/helpers'** **make[2]: Leaving directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent/helpers'** **making all in /home/jzavgren/code/net-snmp-5.7.2.1/agent/mibgroup** **make[2]: Entering directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent/mibgroup'** **make[2]: Leaving directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent/mibgroup'** **/bin/bash ../libtool --mode=link gcc -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -o snmpd snmpd.lo libnetsnmpagent.la libnetsnmpmibs.la ../snmplib/libnetsnmp.la -lm -Wl,-E ** **libtool: link: gcc -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -o .libs/snmpd .libs/snmpd.o -Wl,-E ./.libs/libnetsnmpagent.so -L/usr/local/lib -L/usr/lib/perl/5.14/CORE ./.libs/libnetsnmpmibs.so /home/jzavgren/code/net-snmp-5.7.2.1/agent/.libs/libnetsnmpagent.so /home/jzavgren/code/net-snmp-5.7.2.1/snmplib/.libs/libnetsnmp.so -lperl -ldl -lpthread -lc -lcrypt ../snmplib/.libs/libnetsnmp.so -lrt -lcrypto -lm -Wl,-rpath -Wl,//lib** **./.libs/libnetsnmpagent.so: undefined reference to `netsnmp_udp6_parse_security'** **./.libs/libnetsnmpagent.so: undefined reference to `netsnmp_UDPIPv6Domain'** **./.libs/libnetsnmpagent.so: undefined reference to `netsnmp_udp6_getSecName'** **./.libs/libnetsnmpagent.so: undefined reference to `netsnmp_TCPIPv6Domain'** **collect2: ld returned 1 exit status** **make[1]: *** [snmpd] Error 1** **make[1]: Leaving directory `/home/jzavgren/code/net-snmp-5.7.2.1/agent'** **make: *** [subdirs] Error 1** * -- Dr. John Zavgren, Cyber Systems and Technology Group voice: 781-981-8236 email:john.zavg...@ll.mit.edu MIT Lincoln Laboratory 244 Wood Street Lexington, MA 02420-9185www:http://www.ll.mit.edu/CST-- Dr. John Zavgren, Cyber Systems and Technology Group voice: 781-981-8236 email:john.zavg...@ll.mit.edu MIT Lincoln Laboratory 244 Wood Street Lexington, MA 02420-9185www:http://www.ll.mit.edu/CST
-- Dr. John Zavgren, Cyber Systems and Technology Group voice: 781-981-8236 email: john.zavg...@ll.mit.edu MIT Lincoln Laboratory 244 Wood Street Lexington, MA 02420-9185 www: http://www.ll.mit.edu/CST
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders