summaryrefslogtreecommitdiff
path: root/src/common/md5calc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-03-11 02:30:22 +0100
committerGitHub <noreply@github.com>2018-03-11 02:30:22 +0100
commit69377ed87bf660901b70c47f028cd228165eeef9 (patch)
tree5b180412d7f57491caf1073d0fef6531781cce69 /src/common/md5calc.c
parentb2b4f1b26e5965b09d53ac55040ef1517a81bae0 (diff)
parent0859d24829678c03b103180a9018001087516b0c (diff)
downloadhercules-69377ed87bf660901b70c47f028cd228165eeef9.tar.gz
hercules-69377ed87bf660901b70c47f028cd228165eeef9.tar.bz2
hercules-69377ed87bf660901b70c47f028cd228165eeef9.tar.xz
hercules-69377ed87bf660901b70c47f028cd228165eeef9.zip
Merge pull request #1981 from 4144/fixmd5
Fix md5 calculation for binary strings.
Diffstat (limited to 'src/common/md5calc.c')
-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.