with debugging turned on).
md5sum() builds an md5 message digest in a buffer. Originally
it used memset() to initialize the buffer with binary zeroes.
At some point the call to memset() was replaced with the
osrf_clearbuf() macro. When compiled in debugging mode,
osrf_clearbuf() fills the buffer with exclamation points;
otherwise it reverts to the original memset().
In this case the use of osrf_clearbuf is inappropriate, because
we use strcat() to build the message digest, two bytes at a
time. We don't need to use memset(), but the first byte needs
to be initialized to a nul byte so that strcat() will work as
intended. Hence:
1. Remove the call to osrf_clearbuf().
2. Put a nul byte at the beginning of the buffer.
Also, I made the buffer smaller. There's no reason for it
to be 256 bytes long.
M src/libopensrf/utils.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1809
9efc2488-bf62-4759-914b-
345cdb29e865
MD5_stop (&ctx, digest);
char buf[16];
- char final[256];
- osrf_clearbuf(final, sizeof(final));
+ char final[ 1 + 2 * sizeof( digest ) ];
+ final[0] = '\0';
for ( i=0 ; i<16 ; i++ ) {
snprintf(buf, sizeof(buf), "%02x", digest[i]);