summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/passwd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/passwd.c b/common/passwd.c
index 9e7dacb..0f8425d 100644
--- a/common/passwd.c
+++ b/common/passwd.c
@@ -526,7 +526,9 @@ char *eurephia_pwd_crypt(eurephiaCTX *ctx, const char *key, const char *salt) {
// If we have a salt, use it
snprintf(saltstr, MAX_SALT_LEN+20, "%s%c", salt, 0);
}
- result = sha512_crypt_r(key, saltstr, maxrounds, buffer, buflen);
+ // For some reason, if not strdup()ing 'buffer' and returning buffer it causes a memory leak
+ result = strdup_nullsafe(sha512_crypt_r(key, saltstr, maxrounds, buffer, buflen));
+ free_nullsafe(NULL, buffer);
return result;
}
@@ -554,7 +556,8 @@ char *eurephia_quick_hash(const char *salt, const char *pwd) {
}
if( salt != NULL ) {
- tmp = (char *) malloc_nullsafe(NULL, strlen_nullsafe(salt) + len + 2);
+ tmp = (char *) malloc_nullsafe(NULL, strlen_nullsafe(salt) + len + 10);
+ memset(tmp,0, strlen_nullsafe(salt) + len + 2);
sprintf(tmp, "%s%s", pwd, salt);
} else {
tmp = strdup_nullsafe(pwd);