summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2021-09-19 13:47:02 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-10-03 11:13:50 +0000
commit212f9308d4b4a3fcbdd801e8e7917aa5c2034b78 (patch)
tree633b221ef04eb3d24ba1ced0d1520ce124a8f291 /Userland
parent06f30943ef2b5b1441ca59bd921acdf75b8d611a (diff)
downloadserenity-212f9308d4b4a3fcbdd801e8e7917aa5c2034b78.zip
LibC: Specifically clear only stored bytes after successful mbrtowc
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/wchar.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/wchar.cpp b/Userland/Libraries/LibC/wchar.cpp
index 040110b084..bf2f855b14 100644
--- a/Userland/Libraries/LibC/wchar.cpp
+++ b/Userland/Libraries/LibC/wchar.cpp
@@ -280,8 +280,8 @@ size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* state)
*pwc = codepoint;
}
- // We don't have a shift state that we need to keep, so just clear the entire state
- *state = {};
+ // We want to read the next multibyte character, but keep all other properties.
+ state->stored_bytes = 0;
if (codepoint == 0) {
return 0;