Skip to content

Fix GH-25009: GetConsoleTitleW() buffer size passed in bytes - #25011

Open
lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25009
Open

lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25009

Conversation

@lazerg

@lazerg lazerg commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

get_ps_title() passed sizeof(ps_buffer_w) to GetConsoleTitleW(), but nSize is a count of characters, not bytes. That told the API the 260-wchar_t buffer could hold 520 characters, so a console title of 260 or more characters set by another process overflowed the stack buffer. This passes MAX_PATH, the buffer's real length, so long titles get truncated instead.

No test, since it needs a console title longer than PHP itself allows to set, which another process has to set on the same console.

Fixes #25009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant