diff options
author | Dan Winship <danw@src.gnome.org> | 2008-01-15 06:21:58 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2008-01-15 06:21:58 +0000 |
commit | cc1404cfc8ad8cb0d3c95307dcc92c48a57d9a3b (patch) | |
tree | 09787f7a514769d451abb201d56f260e6cbad1bd /glib/gchecksum.c | |
parent | e943c3af74a39ea7d0534bf7ec8f824d17f04764 (diff) | |
download | glib-cc1404cfc8ad8cb0d3c95307dcc92c48a57d9a3b.tar.gz |
fix this; the previous code gave the wrong md5sum when called in certain
* glib/gchecksum.c (md5_sum_update): fix this; the previous code
gave the wrong md5sum when called in certain ways with buffers
larger than 64 bytes.
(g_checksum_update): remove the unnecessary "length > 1"
restriction
* tests/checksum-test.c: Rewrite this to be much more exhaustive
(and in particular to test the md5_sum_update bugfix).
svn path=/trunk/; revision=6314
Diffstat (limited to 'glib/gchecksum.c')
-rw-r--r-- | glib/gchecksum.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/glib/gchecksum.c b/glib/gchecksum.c index bda38b829..8de9d127c 100644 --- a/glib/gchecksum.c +++ b/glib/gchecksum.c @@ -315,7 +315,7 @@ md5_sum_update (Md5sum *md5, guchar *p = (guchar *) md5->data + bit; bit = MD5_DATASIZE - bit; - if (length < MD5_DATASIZE) + if (length < bit) { memcpy (p, data, bit); return; @@ -1202,7 +1202,6 @@ g_checksum_update (GChecksum *checksum, { g_return_if_fail (checksum != NULL); g_return_if_fail (data != NULL); - g_return_if_fail (length > 1); if (checksum->digest_str) { |