On 18 October 2010 15:13, Leo Lin <hayashi_...@yahoo.com> wrote:
> Then, I issue an snmpset and modify the contents to a strlen less than 
> 'private' (7).
> snmpset does it right the first time, but consecutives calls to snmpset,
> gives me the remainder of 'private'

It sounds as if you are forgetting to add the null terminator to
your internal string buffer, when setting the new value.


> I used DEBUGMSGTL to track the len of requests->requestvb->val.string,
> and it shows me that for snmpset to "leo", the strlen is still 7 instead of 3.

What exactly do you mean by this?
What is the value of 'requests->requestvb->val_len' ?

Remember that the Net-SNMP library uses a (value+length) approach
to varbind values,  rather than assuming all strings will be null-terminated.

> I also made sure that I've clear my buffer using
>    memset(_myoid, '\0', _myoid_len);

That's the OID buffer.
What are you doing with the buffer that holds the string value?

Dave

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to