[php-src] PHP-8.5: Fix GH-25009: GetConsoleTitleW() buffer size passed in bytes
| From: | lazerg via ndossche | Date: | Sun, 01 Nov 2026 12:49:35 +0000 |
| Subject: | [php-src] PHP-8.5: Fix GH-25009: GetConsoleTitleW() buffer size passed in bytes | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143134@lists.php.net to get a copy of this message | ||
Author: lazerg (lazerg)
Committer: ndossche (ndossche)
Date: 2026-11-01T13:48:23+01:00
Commit: https://github.com/php/php-src/commit/113bc87d5ace933d99d04df9f0e307ef7cea42fe
Raw diff: https://github.com/php/php-src/commit/113bc87d5ace933d99d04df9f0e307ef7cea42fe.diff
Fix GH-25009: GetConsoleTitleW() buffer size passed in bytes
Closes GH-25011.
Changed paths:
M NEWS
M sapi/cli/ps_title.c
Diff:
diff --git a/NEWS b/NEWS
index a9c4db67e371..ea8935bd64ae 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 642e2247cfbc..b6f0e0400e71 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;
}