From ac0b6e180e7593ef0de7ebbce7d8963dcf50aaac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Feb 2018 23:34:51 +0300 Subject: Fix md5 calculation for binary strings. --- src/common/md5calc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/md5calc.c b/src/common/md5calc.c index d2fc32371..d5ce8b5a8 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -202,7 +202,7 @@ static void md5_buf2binary(const uint8 *buf, const int buf_size, uint8 *output) //1-3 copy_len = buf_size % 64; //The number of bytes which remained is computed. - strncpy((char *)padding_message, (const char *)pbuf, copy_len); // A message is copied to an extended bit sequence. + memcpy((char *)padding_message, (const char *)pbuf, copy_len); // A message is copied to an extended bit sequence. memset(padding_message+copy_len, 0, 64 - copy_len); //It buries by 0 until it becomes extended bit length. padding_message[copy_len] |= 0x80; //The next of a message is 1. -- cgit v1.2.3-70-g09d2