Navigation Menu

Skip to content

Commit

Permalink
Fix UBSAN warning about applying zero offset to null pointer (#10700)
Browse files Browse the repository at this point in the history
vpath may be NULL here so check for it before trying to add 0 (the length of the vpath) to it.
  • Loading branch information
Girgias committed Feb 26, 2023
1 parent 375e740 commit 382148d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sapi/cli/php_cli_server.c
Expand Up @@ -1785,8 +1785,10 @@ static int php_cli_server_client_read_request_on_message_complete(php_http_parse
php_cli_server_client *client = parser->data;
client->request.protocol_version = parser->http_major * 100 + parser->http_minor;
php_cli_server_request_translate_vpath(&client->request, client->server->document_root, client->server->document_root_len);
{
const char *vpath = client->request.vpath, *end = vpath + client->request.vpath_len, *p = end;
if (client->request.vpath) {
const char *vpath = client->request.vpath;
const char *end = vpath + client->request.vpath_len;
const char *p = end;
client->request.ext = end;
client->request.ext_len = 0;
while (p > vpath) {
Expand Down

0 comments on commit 382148d

Please sign in to comment.