The bug report contains a code snippet that itself contains a bug.  The
second code snippet:
len = sizeof(buf);
read_config_read_octet_string(str, (u_char**)&buf, &len);
snmp_log(LOG_INFO, "len:%d, buf:%s\n", len, buf);

The second param to read_config_read_octet_string should be a pointer to
a pointer to the buffer.  In this case it is just passing in a pointer
to the buffer.  In other words, not enough redirection.

Try:
pt = buf; /* or to better illustrate, pt = &buf[0] */
len = sizeof(buf);
read_config_read_octet_string(str, &pt, &len);
snmp_log(LOG_INFO, "len:%d, buf:%s\n", len, buf);

There are also multiple examples of correct usage in snmplib/vacm.c

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, September 28, 2004 4:48 AM
To: [EMAIL PROTECTED]
Subject: Re: Am I confused or is read_config_read_octet_string broken?

> ...
> I'd say that the basic problem here is that the behaviour is not
> documented properly.  (Like so much else!)
> I'd suggest that:
> 
> Robert> adding one line before the read will fix your problem:
> Robert>         len = sizeof(value);
> 
> this is the correct approach, and we just need to document it.

As noted in bug 1029287, this "correct approach" seems to have a bug in
its implementation.

http://sourceforge.net/tracker/index.php?func=detail&aid=1029287&group_i
d=12694&atid=112694



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
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


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
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