[AGENT++] Possible bug in OctetStr::clear?

Frank Fock fock at agentpp.com
Thu Nov 4 18:54:57 CET 2004


Hi Fedja,

I would think that OctetStr::clear() should also reset the length,
but we will have to check if the clear() method is used anywhere
with its current meaning. I think a fix will be available on Monday
or Tuesday next week.

Best regards,
Frank

Mr. AWD wrote:

>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!
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://agentpp.org/mailman/listinfo/agentpp
>
>  
>





More information about the AGENTPP mailing list