Skip to content

Commit 4b5e824

Browse files
committed
Use unsigned char in _crypt_extended_r
Avoid signed shift UB.
1 parent bee7973 commit 4b5e824

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ext/standard/crypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
179179
memset(&buffer, 0, sizeof(buffer));
180180
_crypt_extended_init_r();
181181

182-
crypt_res = _crypt_extended_r(password, salt, &buffer);
182+
crypt_res = _crypt_extended_r((const unsigned char *) password, salt, &buffer);
183183
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
184184
return NULL;
185185
} else {

ext/standard/crypt_freesec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ des_cipher(const char *in, char *out, uint32_t salt, int count,
607607
}
608608

609609
char *
610-
_crypt_extended_r(const char *key, const char *setting,
610+
_crypt_extended_r(const unsigned char *key, const char *setting,
611611
struct php_crypt_extended_data *data)
612612
{
613613
int i;

ext/standard/crypt_freesec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct php_crypt_extended_data {
2828

2929
void _crypt_extended_init(void);
3030

31-
char *_crypt_extended_r(const char *key, const char *setting,
31+
char *_crypt_extended_r(const unsigned char *key, const char *setting,
3232
struct php_crypt_extended_data *data);
3333

3434
#endif

0 commit comments

Comments
 (0)