When I inserted printf statement to see the value of , (void *)(requests->requestvb->val.string)
it itself is not being cleared. The problem started here itself and thats why if I SET "test123" first and then SET "try0" it is showing "try0123". Since requests->requestvb->val.string holds the value what we setting ,I am copying this value into the string rcommunity strcpy(struct_obj.rcommunity,(void *)(requests->requestvb->val.string)); So, clearing rcommunity using memset(struct_obj.rcommunity, 0, sizeof(stuct_obj.rcommunity)); is not solving my issue. Thanks. On 6/22/05, Dave Shield <[EMAIL PROTECTED]> wrote: > On Tue, 2005-06-21 at 12:51, aakansha rajvi wrote: > > First if I set "test" to a string type oid , snmpget results in "test". > > Again if I set "try" to the same oid, the result of snmpget is "tryt" > > ie., the length of the variable holding this string is growing dynamically. > > Not exactly. > It looks as if the buffer holding the current value isn't getting > cleared before you insert the new one. My guess is that if you > issue a SET of "test123", then GET will return the correct value. > If you then issue a SET of "try0", then GET will return "try0123" > > > > Pls see the attached sample code(containing handler function and > > varaible declaration alone) I am using for one particular scalar > > string type oid. > > > case MODE_SET_ACTION: > : > strcpy(struct_obj.rcommunity, > (void*)(requests->requestvb->val.string)); > > > Try clearing the 'rcommunity' buffer before you assign the > new value. Something like: > > case MODE_SET_ACTION: > : > + memset(struct_obj.rcommunity, 0, sizeof(stuct_obj.rcommunity)); > strcpy(struct_obj.rcommunity, > (void*)(requests->requestvb->val.string)); > > > Dave > > ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
