Hi,

I am not using any str* functions. Its only memcpy. Please check the code
below:
for(vars=response->variables;vars;vars=vars->next_variable)
{
      if(vars->type == ASN_OCTET_STR)
      {
              char *sp = (char*)malloc(1+vars->val_len);
              memcpy(sp,vars->val.string,vars->val_len);
              sp[vars->val_len] = '\0';

               //process the sp buffer

      }
}


Thanks & Regards
Geet Bhatia



On Mon, Sep 9, 2013 at 9:04 PM, Niels Baggesen 
<n...@users.sourceforge.net>wrote:

> Den 09-09-2013 10:52, Geet Bhatia skrev:
>
>  The value sent by agent is correct. I have checked it on wireshark. Even
>> the print_variable is printing correct value on console. But I am not
>> able to get this value copied in buffer.
>>
>
> This does not make sense. If print_variable can print it, then the data is
> there, and your memcpy should copy it alright.
>
> Are you trying to process the value using str* functions which will not
> work when the first byte of the value is a NUL?
>
> /Niels
>
> --
> Niels Baggesen - @home - Ã…rhus - Denmark - n...@users.sourceforge.net
> The purpose of computing is insight, not numbers   ---   R W Hamming
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to