Robert Story wrote:
> On Thu, 22 Jun 2006 12:32:47 -0700 Wes wrote:
> WH>   So....  The solution?  Either:
> WH> 
> WH>   A) The solution you've done which is to create a new
> WH>   wrapper function.  Put that in the base code and encourage it for
> WH>   all use of strings which need to be null terminated.
> WH> 
> WH>   B) encourage people to simply pass in the re-allocatable bit if
> WH>      they're going to print.  Then reallocate if you're at exact
> WH>      length so you can add the null.
> 
> I vote A. Firmly. Loudly.

My opinion is that this shouldn't exist in the library at all (unless
Net-SNMP itself is already (ab)using null-terminating power of this
function).

David's previous remark is correct, an octet-string may contain any
character (including a '\0' in the middle of the string), simply
ensuring the string is null-terminated at the end doesn't solve
anything, all it does is to promote bad code and hide bugs. Imho.., and
I don't think an API should do that.

Having said that, there also an option C, to combine A+B, write a wapper
function wich looks like:

u_char *
asn_parse_string_nt(u_char **sptr, size_t slen, int reallocate)

//Gustaf

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to