[AGENT++] Possible bug in OctetStr::clear?
Mr. AWD
mrawd at excite.com
Thu Nov 4 17:47:02 CET 2004
Hello again!
Well, after looking a bit further into the code, what seems to be a problem is clearing of the octet string with member function OctetStr::clear(), shown bellow form snmp++/src/octet.cpp. The function just clears the data and resets it to zero. The problem is that length of the string still remains the same. If we use += operator on such a cleared string, new string will be concatenated after the original length of the string that is not there any more.
Should this function also clear the length of the string or I have to find the other way? A possibility is to use set_data(unsigned char * str, unsigned long len) function and use it with an empty string with zero length. But, if original clear would clear things all the way, this would not be necessary.
Is there any chance to have this fixed?
Thanks
Fedja
//==============[ Null out the contents of the string ]===================
void OctetStr::clear()
{
if (smival.value.string.ptr)
memset(smival.value.string.ptr, 0, smival.value.string.len);
if (output_buffer)
memset(output_buffer, 0, output_buffer_len);
}
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
More information about the AGENTPP
mailing list