diff options
author | gumi <git@gumi.ca> | 2020-07-15 19:03:57 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2020-07-15 19:25:59 -0400 |
commit | 3a886cf674fbaf971620538ae2365b317db1a257 (patch) | |
tree | ccb73f7b1267ab3152fad13b43918b28224f258d | |
parent | c25ee06f212172fa77ba8ae14c6de0b2e1c1210c (diff) | |
download | evol-hercules-3a886cf674fbaf971620538ae2365b317db1a257.tar.gz evol-hercules-3a886cf674fbaf971620538ae2365b317db1a257.tar.bz2 evol-hercules-3a886cf674fbaf971620538ae2365b317db1a257.tar.xz evol-hercules-3a886cf674fbaf971620538ae2365b317db1a257.zip |
stop harassing me, gcc
-rw-r--r-- | src/elogin/md5calc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/elogin/md5calc.c b/src/elogin/md5calc.c index e2c9235..e5d17ed 100644 --- a/src/elogin/md5calc.c +++ b/src/elogin/md5calc.c @@ -253,7 +253,7 @@ void MD5_String2binary (const char *string, char *output) 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. - //1-4 + //1-4 //If 56 bytes or more (less than 64 bytes) of remainder becomes, it will calculate by extending to 64 bytes. if (56 <= copy_len) { @@ -326,11 +326,13 @@ char *MD5_saltcrypt(const char *key, const char *salt) // Hash the buffer back into sbuf MD5_String(buf, sbuf); - // explicitly truncate the hash to fit in obuf - int salt_len = (int)safestrnlen(salt, 30); - sbuf[30 - salt_len] = '\0'; + char *p = obuf; + *p = '!'; + strncpy(++p, salt, 30); + int len = (int)safestrnlen(p, 30); + *(p + len) = '$'; + strncpy(p + len + 1, sbuf, 29 - len); - snprintf(obuf, 32, "!%s$%s", salt, sbuf); return(obuf); } @@ -409,4 +411,3 @@ in_addr_t MD5_ip(char *secret, in_addr_t ip) return conv.ip; } - |