1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

GetDlgItemTextW_alloc: use the right memchr.

When retrieving Unicode text from an edit box in the GUI configurer,
we were using plain memchr() to look for a terminating NUL. But of
course you have to use wmemchr() to look for a UTF-16 NUL, or else
memchr() will generate a false positive on the UTF-16 version of (at
least) any ASCII character!

(I also have to provide a fallback implementation of wmemchr for the
w32old builds, which don't have it in the libc they build against.
It's as simple as possible, and we use the libc version where
possible.)
This commit is contained in:
Simon Tatham
2025-01-13 20:43:22 +00:00
parent 293be04298
commit e7acb9f696
6 changed files with 28 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#cmakedefine01 HAVE_GETNAMEDPIPECLIENTPROCESSID
#cmakedefine01 HAVE_SETDEFAULTDLLDIRECTORIES
#cmakedefine01 HAVE_STRTOUMAX
#cmakedefine01 HAVE_WMEMCHR
#cmakedefine01 HAVE_DWMAPI_H
#cmakedefine NOT_X_WINDOWS

View File

@ -53,6 +53,7 @@ define_negation(NO_HTMLHELP HAVE_HTMLHELP_H)
check_include_files("winsock2.h;afunix.h" HAVE_AFUNIX_H)
check_symbol_exists(strtoumax "inttypes.h" HAVE_STRTOUMAX)
check_symbol_exists(wmemchr "wchar.h" HAVE_WMEMCHR)
check_symbol_exists(AddDllDirectory "windows.h" HAVE_ADDDLLDIRECTORY)
check_symbol_exists(SetDefaultDllDirectories "windows.h"
HAVE_SETDEFAULTDLLDIRECTORIES)