Sitelet https://github.com/phpredis/phpredis/commit/ee210f86
Skip to content

Commit ee210f8

Browse files
committed
Fix security alerts
1 parent bfe05a6 commit ee210f8

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

‎redis_commands.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ int redis_key_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
450450
int redis_flush_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
451451
char *kw, char **cmd, int *cmd_len, short *slot, void **ctx)
452452
{
453-
zend_bool sync = -1;
453+
int sync = -1;
454454

455455
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &sync) == FAILURE) {
456456
return FAILURE;
@@ -549,10 +549,12 @@ int redis_zrange_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
549549
if (z_ws) {
550550
if (Z_TYPE_P(z_ws) == IS_ARRAY) {
551551
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(z_ws), zkey, z_ele) {
552-
ZVAL_DEREF(z_ele);
553-
if (zend_string_equals_literal_ci(zkey, "withscores")) {
554-
*withscores = zval_is_true(z_ele);
555-
break;
552+
if (zkey != NULL) {
553+
ZVAL_DEREF(z_ele);
554+
if (zend_string_equals_literal_ci(zkey, "withscores")) {
555+
*withscores = zval_is_true(z_ele);
556+
break;
557+
}
556558
}
557559
} ZEND_HASH_FOREACH_END();
558560
} else if (Z_TYPE_P(z_ws) == IS_TRUE) {
@@ -4024,16 +4026,13 @@ append_stream_args(smart_string *cmdstr, HashTable *ht, RedisSock *redis_sock,
40244026
char *kptr, kbuf[40];
40254027
int klen, i, pos = 0;
40264028
zend_string *key, *idstr;
4027-
short oldslot;
4029+
short oldslot = -1;
40284030
zval **id;
40294031
zend_ulong idx;
40304032

40314033
/* Append STREAM qualifier */
40324034
REDIS_CMD_APPEND_SSTR_STATIC(cmdstr, "STREAMS");
40334035

4034-
/* Sentinel slot */
4035-
if (slot) oldslot = -1;
4036-
40374036
/* Allocate memory to keep IDs */
40384037
id = emalloc(sizeof(*id) * zend_hash_num_elements(ht));
40394038

0 commit comments

Comments
 (0)