On Fri, Jun 4, 2010 at 1:34 AM, Brendan Tauras <[email protected]> wrote:

> Thank you for the advice.  It helped me learn more about the Net-SNMP
> library, but unfortunately it did not solve the issue with
> uninitialized syscall data.
>
> I used memset() to initialize the "struct snmp_session" before passing
> it to snmp_sess_init(), but I cannot memset() the "struct snmp_pdu"
> because it is allocated and initialized by snmp_pdu_create() before I
> can do any initialization.
>
> I also tried adding null byte padding to the end of the character
> arrays pointed to in the "hosts" and "oids" arrays in the async app (
> http://www.net-snmp.org/wiki/index.php/TUT:Simple_Async_Application ).
>  The initialization did not stop the valgrind errors (see attached
> files asyncapp.c and gdb.log).
>
> I think in the function header in snmpUDPDomain.c:184:
>
> static int netsnmp_udp_send(netsnmp_transport *t, void *buf, int size,
> void **opaque, int *olength)
>
> "void *buf" is actually a "struct snmp_session *"/"netsnmp_session *",
> but I do not know what type "void **opaque" is.  I noticed that the
> "peername" pointer in "buf" is invalid when examining with gdb (see
> attached file gdb.log) :
>
> peername = 0x114c10000 <Address 0x114c10000 out of bounds>
>
> Here's the valgrind error message again from the asynchronous context
> in case you have any other thoughts:
>
> ==798== 8 errors in context 2 of 7:
> ==798== Syscall param ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝ
> points to uninitialised byte(s)
> ==798==    at 0x51C2A60: __sendmsg_nocancel (in /lib64/libc-2.10.1.so)
> ==798==    by 0x4E8BB0F: netsnmp_udp_send (snmpUDPDomain.c:184)
> ==798==    by 0x4E60AB2: snmp_sess_async_send (snmp_api.c:4862)
> ==798==    by 0x401315: asynch_response (asyncapp.c:188)
> ==798==    by 0x4E64BB0: _sess_process_packet (snmp_api.c:5239)
> ==798==    by 0x4E669B3: _sess_read (snmp_api.c:5742)
> ==798==    by 0x4E671B0: snmp_sess_read (snmp_api.c:5761)
> ==798==    by 0x4E671F1: snmp_read (snmp_api.c:5378)
> ==798==    by 0x401045: asynchronous (asyncapp.c:254)
> ==798==    by 0x4014E4: main (asyncapp.c:276)
> ==798==  Address 0x7fefff6c8 is on thread 1's stack
> ==798==  Uninitialised value was created by a stack allocation
> ==798==    at 0x4E8B9A2: netsnmp_udp_send (snmpUDPDomain.c:246)
>

With which Net-SNMP version did this occur ?

Bart.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to