Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cf2c052

Browse files
committed
Fix invalid allocation size
1 parent 1fb2935 commit cf2c052

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

library.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,12 +1195,14 @@ redis_parse_client_list_response(char *response, zval *z_ret)
11951195
{
11961196
char *p1, *s1 = NULL;
11971197

1198+
ZVAL_FALSE(z_ret);
11981199
if ((p1 = php_strtok_r(response, _NL, &s1)) != NULL) {
11991200
array_init(z_ret);
12001201
do {
12011202
char *p2, *s2 = NULL;
12021203
zval z_sub;
12031204

1205+
ZVAL_FALSE(&z_sub);
12041206
if ((p2 = php_strtok_r(p1, " ", &s2)) != NULL) {
12051207
array_init(&z_sub);
12061208
do {
@@ -1218,19 +1220,15 @@ redis_parse_client_list_response(char *response, zval *z_ret)
12181220
add_assoc_double_ex(&z_sub, p2, p - p2, dval);
12191221
break;
12201222
default:
1221-
add_assoc_stringl_ex(&z_sub, p2, p - p2, p + 1, s2 - p - 2);
1223+
add_assoc_string_ex(&z_sub, p2, p - p2, p + 1);
12221224
}
12231225
} else {
12241226
add_next_index_string(&z_sub, p2);
12251227
}
12261228
} while ((p2 = php_strtok_r(NULL, " ", &s2)) != NULL);
1227-
} else {
1228-
ZVAL_FALSE(&z_sub);
12291229
}
12301230
add_next_index_zval(z_ret, &z_sub);
12311231
} while ((p1 = php_strtok_r(NULL, _NL, &s1)) != NULL);
1232-
} else {
1233-
ZVAL_FALSE(z_ret);
12341232
}
12351233
}
12361234

0 commit comments

Comments
 (0)