Hi,

I posted before and I got a very helpful reply from Dave but I can't 
find the thread.
It worked on the application I was working on at the time but in another 
function snmp_parse_oid seems to corrupt some memory.

I'm trying to build an agent to handle ASN_OBJECT_ID types. Everywhere 
in my application code i define the OIDs as  a string.

char vendor[TR_MIB_MAX_OID_LEN] = "1.3.6.1.4.1.28215";
inventory[idx] = vendor;

tr_mib_add_item(context, 3, "vendortype", "entPhysicalVendorType", 
TR_MIB_OID,TR_MIB_RO, NULL,NULL, NULL, 0, 0, &(inventory[0].vendor), w);

agent :
case TR_MIB_OID:
       value = val->s;
       snmp_parse_oid(value,root,&rootlen);
       TR_DEBUG_D(TR_SNMP_DEBUG_REQ, "Returning value type 
ASN_OBJECT_ID, value %s", value);
       snmp_set_var_typed_value(idx, ASN_OBJECT_ID,(char 
*)&root,rootlen*sizeof(int));
       break;

**it's exactly the same application of the code before in a different 
function used exactly the same way**

when i do an snmpwalk of the inventory, it crashes right after printing 
out the OIDs.

On the debugger :

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 485)]
0xb7d1aa64 in strchr () from /lib/libc.so.0
(gdb) bt
#0  0xb7d1aa64 in strchr () from /lib/libc.so.0
#1  0xb7e99ac0 in snmp_parse_oid (argv=0x0, root=0xbfbeec80, 
rootlen=0xbfbeec7c) at mib.c:5820
#2  0x080744ae in _tr_mib_set_scalar (item=0xb785afb8, instance={{i = 
22, s = 0x16 <Address 0x16 out of bounds>}}, idx=0xb5459db4)
    at /u0/dev/wls_raisom/3route_lib/tr_mib_agent.c:125
#3  0x080755f4 in _tr_mib_table_handle_request (handler=0xb5ae6fe8, 
reginfo=0xb5aeafd0, reqinfo=0xb5475ff4, requests=0xb5477fc0)
    at /u0/dev/wls_raisom/3route_lib/tr_mib_agent.c:456
#4  0xb7e59b3a in netsnmp_call_next_handler (current=0x8075045, 
reginfo=0xb5aeafd0, reqinfo=0xb5475ff4, requests=0xb5477fc0) at 
agent_handler.c:435
#5  0xb7e3af43 in table_helper_handler (handler=0xb5af0fe8, 
reginfo=0xb5aeafd0, reqinfo=0xb5475ff4, requests=0xb5477fc0) at table.c:619
#6  0xb7e59708 in netsnmp_call_handlers (reginfo=0xb5aeafd0, 
reqinfo=0xb5475ff4, requests=0xb5477fc0) at agent_handler.c:435
#7  0xb7e4d005 in handle_var_requests (asp=0xb546ffb8) at snmp_agent.c:2491
#8  0xb7e4dc67 in handle_pdu (asp=0xb546ffb8) at snmp_agent.c:3280
#9  0xb7e4f01f in netsnmp_handle_request (asp=0xb546ffb8, 
status=-1208834532) at snmp_agent.c:3076
#10 0xb7e4f60d in handle_snmp_packet (op=1, session=0xb546ffb8, 
reqid=164, pdu=0x0, magic=0x0) at snmp_agent.c:1850
#11 0xb7eb3b22 in _sess_process_packet (sessp=0xb76a5ff0, sp=0xb76a9f08, 
isp=0xb76a7fd0, transport=0xb7626fc0, opaque=0xb5455ffc, olength=4, 
packetptr=0xb5444000 "\001\006",
    length=1) at snmp_api.c:5360
#12 0xb7eb505e in _sess_read (sessp=0xb76a5ff0, fdset=0xbfbef730) at 
snmp_api.c:5779
#13 0xb7eb5b09 in snmp_sess_read (sessp=0xb76a5ff0, fdset=0x3a3a) at 
snmp_api.c:5798
#14 0xb7eb5b6d in snmp_read (fdset=0xbfbef730) at snmp_api.c:5412
#15 0x0805cc53 in tr_mibserver_start () at 
/u0/dev/wls_raisom/3route_lib/tr_mibserver.c:573
#16 0x0804df0c in main () at /u0/dev/wls_raisom/3route_lite/trl_main.c:236

I think some memory was corrupted but I'm not sure where. Any ideas 
would be most welcome.

Thanks!

Syikin.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
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

Reply via email to