Valgrind reports Invalid read in subagent

Bradley Kite <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CA+JxU+4AYJtV+GeXh8ft8hVEb_iOdPbh47+YK_AgomfACDgMQw@mail.gmail.com>
Hi,

I am testing/debugging a network application heap corruption bug (the
application is also an AgentX subagent), and valgrind is reporting this
error - which I suspect might be the cause of the problem:

==5608== Thread 9:
==5608== Invalid read of size 8
==5608==    at 0x4CFF13: handle_subagent_response (subagent.c:550)
==5608==    by 0x4FB8E3: _sess_process_packet (snmp_api.c:5518)
==5608==    by 0x4FCFC0: _sess_read (snmp_api.c:6043)
==5608==    by 0x4FDCA8: snmp_sess_read2 (snmp_api.c:6075)
==5608==    by 0x4FDD42: snmp_read2 (snmp_api.c:5667)
==5608==    by 0x4C142A: agent_check_and_process (snmp_agent.c:668)
==5608==    by 0x47AE95: snmp_loop(void*) (authent.cpp:1609)
==5608==    by 0x3095007D13: start_thread (in /usr/lib64/libpthread-2.15.so)
==5608==    by 0x30948F167C: clone (in /usr/lib64/libc-2.15.so)
==5608==  Address 0x4e24c00 is 0 bytes inside a block of size 408 free'd
==5608==    at 0x4A079AE: free (vg_replace_malloc.c:427)
==5608==    by 0x4F7877: snmp_sess_close (snmp_api.c:2047)
==5608==    by 0x4F7D62: snmp_sess_select_info2 (snmp_api.c:6207)
==5608==    by 0x4C13EF: agent_check_and_process (snmp_agent.c:638)
==5608==    by 0x47AE95: snmp_loop(void*) (authent.cpp:1609)
==5608==    by 0x3095007D13: start_thread (in /usr/lib64/libpthread-2.15.so)
==5608==    by 0x30948F167C: clone (in /usr/lib64/libc-2.15.so)

I am able to reliably reproduce this by rapidly querying the agent, then
restarting the snmpd service on the host, which suggests that the problem
occurs when the subagent looses its connection to the master.

Any help in fixing this would be greatly appreciated.

Regards
--
Brad.

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.