Skip to content

Commit 3b8ac9e

Browse files
committed
Fix incorrect buffer size with wide conversion
Fixes a bug which would cause keyboard interaction with the browser source to fail.
1 parent dc3500d commit 3b8ac9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deps/wide-string.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ wstring to_wide(const char *utf8)
3333

3434
wstring wide;
3535
wide.resize(osize);
36-
os_utf8_to_wcs(utf8, isize, &wide[0], osize);
36+
os_utf8_to_wcs(utf8, isize, &wide[0], osize + 1);
3737
return wide;
3838
}
3939

@@ -49,6 +49,6 @@ wstring to_wide(const std::string &utf8)
4949

5050
wstring wide;
5151
wide.resize(osize);
52-
os_utf8_to_wcs(utf8.c_str(), utf8.size(), &wide[0], osize);
52+
os_utf8_to_wcs(utf8.c_str(), utf8.size(), &wide[0], osize + 1);
5353
return wide;
5454
}

0 commit comments

Comments
 (0)