]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fixed a overflow bug
authorAndrew Tridgell <tridge@samba.org>
Sat, 30 Mar 2002 13:43:34 +0000 (14:43 +0100)
committerAndrew Tridgell <tridge@samba.org>
Sat, 30 Mar 2002 13:43:34 +0000 (14:43 +0100)
hash.c

diff --git a/hash.c b/hash.c
index a41ec34c6dc6c1f60b07dcbfa5a22ebd91386fff..b5b87bf2fef2aef863d62094bf8a1ea68c1df4fc 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -100,15 +100,16 @@ void hash_file(const char *fname)
 char *hash_result(void)
 {
        unsigned char sum[16];
-       static char ret[33];
+       static char ret[53];
        int i;
 
        hash_buffer(NULL, 0);
        mdfour_result(&md, sum);
        
        for (i=0;i<16;i++) {
-               sprintf(&ret[i*2], "%02x-%d", (unsigned)sum[i], md.totalN);
+               sprintf(&ret[i*2], "%02x", (unsigned)sum[i]);
        }
+       sprintf(&ret[i*2], "-%u", (unsigned)md.totalN);
 
        return ret;
 }