Skip to content

Commit 0bf1971

Browse files
Data type check on redis array host info
RedisArray will segfault if you pass something other than strings into your array of hosts. This is invalid input (needs strings here) but it shouldn't crash php.
1 parent 2552b29 commit 0bf1971

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

redis_array_impl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, long retry_interval, zend_bool b
4444

4545
/* init connections */
4646
for(i = 0; i < count; ++i) {
47-
if(FAILURE == zend_hash_quick_find(hosts, NULL, 0, i, (void**)&zpData)) {
47+
if(FAILURE == zend_hash_quick_find(hosts, NULL, 0, i, (void**)&zpData) ||
48+
Z_TYPE_PP(zpData) != IS_STRING)
49+
{
4850
efree(ra);
4951
return NULL;
5052
}

0 commit comments

Comments
 (0)