Commit 113bc87d5ac for php
commit 113bc87d5ace933d99d04df9f0e307ef7cea42fe
Author: lazerg <lazerg2@gmail.com>
Date: Wed Oct 28 21:41:03 2026 +0500
Fix GH-25009: GetConsoleTitleW() buffer size passed in bytes
Closes GH-25011.
diff --git a/NEWS b/NEWS
index a9c4db67e37..ea8935bd64a 100644
--- a/NEWS
+++ b/NEWS
@@ -321,6 +321,10 @@ PHP NEWS
. Fixed tidy_repair_string(), tidy_repair_file(), tidy::repairString() and
tidy::repairFile() rejecting null for $encoding. (lacatoire)
+- Windows:
+ . Fixed bug GH-25009 (GetConsoleTitleW() buffer size passed in bytes).
+ (Lazizbek Ergashev)
+
- Zip:
. Reject broken libzip versions 1.3.1, 1.7.0 and 1.12.0 during Windows
configuration. (Weilin Du)
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c
index 642e2247cfb..b6f0e0400e7 100644
--- a/sapi/cli/ps_title.c
+++ b/sapi/cli/ps_title.c
@@ -405,7 +405,7 @@ int get_ps_title(size_t *displen, const char** string)
wchar_t ps_buffer_w[MAX_PATH];
char *tmp;
- if (!(ps_buffer_cur_len = GetConsoleTitleW(ps_buffer_w, (DWORD)sizeof(ps_buffer_w)))) {
+ if (!(ps_buffer_cur_len = GetConsoleTitleW(ps_buffer_w, (DWORD)(sizeof(ps_buffer_w) / sizeof(ps_buffer_w[0]))))) {
return PS_TITLE_WINDOWS_ERROR;
}