mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
Merge branch 'PHP-7.2'
* PHP-7.2: remove casts and ensure no out of bounds access sodium ext: delete copypasta from sodium_crypto_kdf_derive_from_key()
This commit is contained in:
commit
7a8c047c23
@ -2989,9 +2989,6 @@ PHP_FUNCTION(sodium_crypto_kdf_derive_from_key)
|
||||
if (key_len != crypto_kdf_KEYBYTES) {
|
||||
zend_throw_exception(sodium_exception_ce, "key should be sodium_crypto_kdf_KEYBYTES bytes", 0);
|
||||
}
|
||||
if (key_len != crypto_kdf_KEYBYTES) {
|
||||
zend_throw_exception(sodium_exception_ce, "context should be sodium_crypto_kdf_KEYBYTES bytes", 0);
|
||||
}
|
||||
memcpy(ctx_padded, ctx, crypto_kdf_CONTEXTBYTES);
|
||||
memset(ctx_padded + crypto_kdf_CONTEXTBYTES, 0, sizeof ctx_padded - crypto_kdf_CONTEXTBYTES);
|
||||
salt[0] = (unsigned char) (((uint64_t) subkey_id) );
|
||||
|
@ -135,8 +135,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
||||
}
|
||||
libpath = estrdup(filename);
|
||||
} else if (extension_dir && extension_dir[0]) {
|
||||
int extension_dir_len = (int)strlen(extension_dir);
|
||||
slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
|
||||
slash_suffix = IS_SLASH(extension_dir[strlen(extension_dir)-1]);
|
||||
/* Try as filename first */
|
||||
if (slash_suffix) {
|
||||
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
|
||||
|
@ -353,7 +353,7 @@ static void php_load_php_extension_cb(void *arg)
|
||||
static void php_load_zend_extension_cb(void *arg)
|
||||
{
|
||||
char *filename = *((char **) arg);
|
||||
const int length = (int)strlen(filename);
|
||||
const size_t length = strlen(filename);
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
(void) length;
|
||||
@ -365,9 +365,13 @@ static void php_load_zend_extension_cb(void *arg)
|
||||
DL_HANDLE handle;
|
||||
char *libpath;
|
||||
char *extension_dir = INI_STR("extension_dir");
|
||||
int extension_dir_len = (int)strlen(extension_dir);
|
||||
int slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
|
||||
int slash_suffix = 0;
|
||||
char *err1, *err2;
|
||||
|
||||
if (extension_dir && extension_dir[0]) {
|
||||
slash_suffix = IS_SLASH(extension_dir[strlen(extension_dir)-1]);
|
||||
}
|
||||
|
||||
/* Try as filename first */
|
||||
if (slash_suffix) {
|
||||
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
|
||||
|
Loading…
Reference in New Issue
Block a user