]> git.evergreen-ils.org Git - OpenSRF.git/commit
Fix a bug in md5sum() (which only affected code compiled
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 8 Oct 2009 18:26:37 +0000 (18:26 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 8 Oct 2009 18:26:37 +0000 (18:26 +0000)
commitad9c44f31e402b8376bcbd75188e4762b134ab0a
tree2c09ff0fb498ef2d79573150510452f0fd757ef0
parentdacfb1cffe6960a41bca6ef9915a40b958ba2b98
Fix a bug in md5sum() (which only affected code compiled
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
src/libopensrf/utils.c