I'm trying to use read_config_read_octet_string() (in 5.1.1) and I'm not getting the 
results I expect.  It is written to allocate space for the return value if needed:

        /*
         * malloc data space if needed (+1 for good measure) 
         */
        if (*str == NULL) {
            if ((cptr = (u_char *) malloc(*len + 1)) == NULL) {
                return NULL;
            }
            *str = cptr;
        } else {
            cptr = *str;
        }

and if I do:

   ...
   char* pt;
   size_t len;
   char* value;
   ...
   value = NULL;
   read_config_read_octet_string(pt, 
                                 (u_char**)&value,
                                 &len);

I get a value parsed out of the string pointed to by pt.  But, if I do:

   ...
   char* pt;
   size_t len;
   char value[32];
   ...
   read_config_read_octet_string(pt, 
                                 (u_char**)&value,
                                 &len);

len has the same value but only one character is copied into value.  Am I missing 
something obvious and stupid?

                            Chris



-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
_______________________________________________
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to