Many code sections still use fixed-size arrays on stack - or even worse - strcat
in combination with strings of unknown length. This MR/PR provides general purpose Wine-internal functions for safer string handling. The functions are currently header-only to not pollute msvcrt exports.
The API was written for an upcoming shell32/shlexec patch (WIP) to properly fix possible stack corruptions due to out-of-bounds writes for unexpected long paths or URLs. This is a dynamic container inspired by C++ std::string / std::vector with wide/narrow conversion and formatted text. Growth factor = 2 for simplicity.
Differences to STRING
/UNICODE_STRING
(RtlCreateUnicodeString
and similar):
- No USHORT length limitation
- Actual dynamic resizable container
- String formatting and conversion support
- Short and consistent API naming
New test added to msvcrt: winestring