From: Nikita Popov Date: Wed, 19 Jun 2019 11:48:20 +0000 (+0200) Subject: Use unsigned char in _crypt_extended_r X-Git-Tag: php-7.4.0alpha2~51^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b5e824aae7117d53f4f1be1351d3eaa79329a40;p=php Use unsigned char in _crypt_extended_r Avoid signed shift UB. --- diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 068d743d1a..d0b1e6a5a7 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -179,7 +179,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch memset(&buffer, 0, sizeof(buffer)); _crypt_extended_init_r(); - crypt_res = _crypt_extended_r(password, salt, &buffer); + crypt_res = _crypt_extended_r((const unsigned char *) password, salt, &buffer); if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) { return NULL; } else { diff --git a/ext/standard/crypt_freesec.c b/ext/standard/crypt_freesec.c index dc51b30150..572e5127b1 100644 --- a/ext/standard/crypt_freesec.c +++ b/ext/standard/crypt_freesec.c @@ -607,7 +607,7 @@ des_cipher(const char *in, char *out, uint32_t salt, int count, } char * -_crypt_extended_r(const char *key, const char *setting, +_crypt_extended_r(const unsigned char *key, const char *setting, struct php_crypt_extended_data *data) { int i; diff --git a/ext/standard/crypt_freesec.h b/ext/standard/crypt_freesec.h index c102736783..69271f23a7 100644 --- a/ext/standard/crypt_freesec.h +++ b/ext/standard/crypt_freesec.h @@ -28,7 +28,7 @@ struct php_crypt_extended_data { void _crypt_extended_init(void); -char *_crypt_extended_r(const char *key, const char *setting, +char *_crypt_extended_r(const unsigned char *key, const char *setting, struct php_crypt_extended_data *data); #endif