Hi,
I submitted a bug on SF (1502990) a few days ago. I never recieved any
response to it so I am thinking maybe that wasn't the right forum to
address.
The problem I am having is that the asn_parse_string() function
null-terminates the string it parses if the size of the recieving char*
is large enough to contain such terminator.
I think this behaivour is wrong and that the returned string should
always be null-terminated (or never).
I am willing to fix this and submit a patch. However fixing it might
possibly break old code (non NetSNMP code -- and NetSNMP code unless it
is audited, which I would do aswell if I undertake this task).
The specific code I am having a problem with is this:
if ((int) asn_length > *strlength) {
_asn_length_err(errpre, (size_t) asn_length,
*strlength);
return NULL;
}
DEBUGDUMPSETUP("recv", data, bufp - data +
asn_length);
memmove(str, bufp, asn_length);
if (*strlength > (int) asn_length)
str[asn_length] = 0;
I want it to be changed so that the first length check is done so that
the string will always be null-terminated on successful return:
if ((int) asn_length >= *strlength) {
... error ...
}
Best regards,
Gustaf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders