[Winpt-commits] r316 - trunk/Generic
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri May 25 16:50:44 CEST 2007
Author: twoaday
Date: 2007-05-25 16:50:43 +0200 (Fri, 25 May 2007)
New Revision: 316
Modified:
trunk/Generic/StringBuffer.cpp
trunk/Generic/StringBuffer.h
Log:
Modified: trunk/Generic/StringBuffer.cpp
===================================================================
--- trunk/Generic/StringBuffer.cpp 2007-05-25 14:45:06 UTC (rev 315)
+++ trunk/Generic/StringBuffer.cpp 2007-05-25 14:50:43 UTC (rev 316)
@@ -83,7 +83,20 @@
return private_contents;
}
+
+/* Overwrite buffer contents in a safe manner. */
+void StringBuffer::wipeContents (void)
+{
+ volatile char *ptr = (volatile char*)private_contents;
+ int len = getSize ();
+ while (len-- > 0) {
+ *ptr = '\0';
+ *ptr++;
+ }
+}
+
+
/* Return the size of the underlying string. */
int StringBuffer::getSize (void)
{
Modified: trunk/Generic/StringBuffer.h
===================================================================
--- trunk/Generic/StringBuffer.h 2007-05-25 14:45:06 UTC (rev 315)
+++ trunk/Generic/StringBuffer.h 2007-05-25 14:50:43 UTC (rev 316)
@@ -34,6 +34,9 @@
/* Destructor which fres the used memory. */
~StringBuffer ();
+ /* Overwrite buffer contents in a safe manner. */
+ void wipeContents (void);
+
/* Return a constant pointer to the 'char*' data of the buffer. */
const char *getBuffer (void);
More information about the Winpt-commits
mailing list