Re: net-snmp agent error when set from a MIB browser
Dave Shield <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
2010/1/15 <[email protected]>: > case MODE_SET_ACTION: > strcpy(set_val,(void*)requests->requestvb->val.string); You need to use the *length* of the value as well. (requests->requestvb->val_len) You cannot assume that string values are null-terminated. Try strncpy ( set_val, requests->requestvb->val.string, requests->requestvb->val_len); set_val[ requests->requestvb->val_len ] = 0; Also, this code appears to be assuming that there will only ever be one varbind in a SET request. The processing should be wrapped within a loop: for ( req = requests; req; req = req->next ) and then take the value from 'req->requestvb->val' instead. Dave ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-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