summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-22 23:34:51 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-22 23:38:15 +0300
commitcf0f1dd3bf5a2ccf8de76fee42f71d04ea0a9e3f (patch)
treeb4c6ed8706b5e301d821e3ff1b518ddddf594e92
parent0a319ab76c84469d87ab851147e2a53cfadbaba2 (diff)
downloadhercules-cf0f1dd3bf5a2ccf8de76fee42f71d04ea0a9e3f.tar.gz
hercules-cf0f1dd3bf5a2ccf8de76fee42f71d04ea0a9e3f.tar.bz2
hercules-cf0f1dd3bf5a2ccf8de76fee42f71d04ea0a9e3f.tar.xz
hercules-cf0f1dd3bf5a2ccf8de76fee42f71d04ea0a9e3f.zip
Fix md5 calculation for binary strings.
-rw-r--r--src/common/md5calc.c2
1 files changed, 1 insertions, 1 deletions
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.