On Wed, 2005-04-20 at 20:23, 02MCMC43-mca-Yirdaw Gashaw wrote: > When I check the value of "request->requestvb->val.string" at > the begining of "MODE_SET_RESERVE1", it has additional characters > at it's end than the new string value I > entered with snmpset command.
And what about 'request->requestvb->val_len' ? Does that hold the length of the correct string, or the "extended" one? > For example, when I entered > > snmpset ... s "aaa", > > The value of "request->requestvb->val.string" was "aaagftr". But was 'request->requestvb->val_len' 3, or 7? Remember that the request->requestvb->val.string buffer is *not* a null-terminated string. It's only the first 'request->requestvb->val_len' characters that are valid. You should ignore everything else. Copy the string using strncpy( my_buffer, request->requestvb->val.string, request->requestvb->val_len); *not* strncpy( my_buffer, request->requestvb->val.string, strlen(request->requestvb->val.string)); or strcpy( my_buffer, request->requestvb->val.string ); Dave ------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders