Re: requesting help

This is a discussion on Re: requesting help within the SNMP Coders forums, part of the Networking and Network Related category; On Wed, 2005-04-20 at 20:23, 02MCMC43-mca-Yirdaw Gashaw wrote: > When I check the value of &...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2005
Dave Shield
 
Posts: n/a
Default Re: requesting help

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/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0