mirror of
https://github.com/php/php-src.git
synced 2024-09-24 11:27:28 +00:00
Fixed bug relating to un-initialized memory access
This commit is contained in:
parent
5842a4147f
commit
1a4456bb76
@ -395,9 +395,10 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b
|
||||
}
|
||||
|
||||
if ((salt - (char *) 0) % __alignof__(uint32_t) != 0) {
|
||||
char *tmp = (char *) alloca(salt_len + __alignof__(uint32_t));
|
||||
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint32_t));
|
||||
salt = copied_salt =
|
||||
memcpy(tmp + __alignof__(uint32_t) - (tmp - (char *) 0) % __alignof__ (uint32_t), salt, salt_len);
|
||||
tmp[salt_len] = 0;
|
||||
}
|
||||
|
||||
/* Prepare for the real work. */
|
||||
|
@ -430,8 +430,8 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
|
||||
}
|
||||
|
||||
if ((salt - (char *) 0) % __alignof__ (uint64_t) != 0) {
|
||||
char *tmp = (char *) alloca(salt_len + __alignof__(uint64_t));
|
||||
|
||||
char *tmp = (char *) alloca(salt_len + 1 + __alignof__(uint64_t));
|
||||
tmp[salt_len] = 0;
|
||||
salt = copied_salt = memcpy(tmp + __alignof__(uint64_t) - (tmp - (char *) 0) % __alignof__(uint64_t), salt, salt_len);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user