Skip to content

Prevent potential buffer overflow for large value of php_cli_server_workers_max #9000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions sapi/cli/php_cli_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2335,7 +2335,7 @@ static void php_cli_server_dtor(php_cli_server *server) /* {{{ */
!WIFSIGNALED(php_cli_server_worker_status));
}

free(php_cli_server_workers);
pefree(php_cli_server_workers, 1);
}
#endif
} /* }}} */
Expand Down Expand Up @@ -2421,12 +2421,8 @@ static void php_cli_server_startup_workers(void) {
if (php_cli_server_workers_max > 1) {
zend_long php_cli_server_worker;

php_cli_server_workers = calloc(
php_cli_server_workers_max, sizeof(pid_t));
if (!php_cli_server_workers) {
php_cli_server_workers_max = 1;
return;
}
php_cli_server_workers = pecalloc(
php_cli_server_workers_max, sizeof(pid_t), 1);

php_cli_server_master = getpid();

Expand Down