On Thu, 15 Jun 2006 12:41:36 +0200 Gustaf wrote:
GG> The problem I am having is that the asn_parse_string() function 
GG> null-terminates the string it parses if the size of the recieving char* 
GG> is large enough to contain such terminator.
GG> 
GG> I think this behaivour is wrong and that the returned string should 
GG> always be null-terminated (or never).

The correct answer is never, since ASN strings are not null terminated.
However, if the buffer is large enough, we do add a null because so many
people think they are null terminated and pass them to printf and friends.
It's just a little additional safety.

GG> I want it to be changed so that the first length check is done so that 
GG> the string will always be null-terminated on successful return:

No, sorry. There is no reason to force anyone who understands the ASN strings
come with a length to allocate bigger buffers because some people don't
understand ASN strings.

-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to