X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=src%2Fmd5.c;h=8824bfe15473b923bc448e57d72fa0db7057dee0;hb=910698ce395ac200b44238477e5278918dcf9782;hp=0fc8a5e97819139ab8c6fe9a07f5783b10c4c49c;hpb=c879e5b17b3d5fef34ab58fc66e1cbb4269e5bb4;p=sxemacs diff --git a/src/md5.c b/src/md5.c index 0fc8a5e..8824bfe 100644 --- a/src/md5.c +++ b/src/md5.c @@ -69,7 +69,7 @@ typedef unsigned short md5_uint32; typedef unsigned long md5_uint32; # else /* The following line is intended to evoke an error. - Using #error is not portable enough. */ + Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif @@ -324,12 +324,12 @@ md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx) #define OP(a, b, c, d, s, T) \ do \ - { \ + { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ - } \ + } \ while (0) /* It is unfortunate that C does not provide an operator for @@ -365,7 +365,7 @@ md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx) argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ - do \ + do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ @@ -570,8 +570,10 @@ file-coding or Mule support. Otherwise, they are ignored. UNGCPRO; md5_finish_ctx(&ctx, digest); - for (i = 0; i < 16; i++) - sprintf((char *)(thehash + (i * 2)), "%02x", digest[i]); + for (i = 0; i < 16; i++) { + int n = snprintf((char *)(thehash + (i * 2)), 3, "%02x", digest[i]); + assert(n>=0 && n < 3); + } return make_string(thehash, 32); }