Skip to content

Commit 8cb3735

Browse files
committed
Prevent potential buffer overflow for large value of php_cli_server_workers_max
1 parent 492f9c6 commit 8cb3735

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sapi/cli/php_cli_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,7 @@ static void php_cli_server_dtor(php_cli_server *server) /* {{{ */
23352335
!WIFSIGNALED(php_cli_server_worker_status));
23362336
}
23372337

2338-
free(php_cli_server_workers);
2338+
efree(php_cli_server_workers);
23392339
}
23402340
#endif
23412341
} /* }}} */
@@ -2421,7 +2421,7 @@ static void php_cli_server_startup_workers(void) {
24212421
if (php_cli_server_workers_max > 1) {
24222422
zend_long php_cli_server_worker;
24232423

2424-
php_cli_server_workers = calloc(
2424+
php_cli_server_workers = ecalloc(
24252425
php_cli_server_workers_max, sizeof(pid_t));
24262426
if (!php_cli_server_workers) {
24272427
php_cli_server_workers_max = 1;

0 commit comments

Comments
 (0)