mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[10108] Prevent access to out of range [0] element of empty string at utf8 convertion.
This commit is contained in:
parent
4e1c8a2ad6
commit
698fe93eb7
2 changed files with 3 additions and 2 deletions
|
|
@ -297,7 +297,8 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
|
|||
size_t len = utf8::distance(utf8str.c_str(),utf8str.c_str()+utf8str.size());
|
||||
wstr.resize(len);
|
||||
|
||||
utf8::utf8to16(utf8str.c_str(),utf8str.c_str()+utf8str.size(),&wstr[0]);
|
||||
if (len)
|
||||
utf8::utf8to16(utf8str.c_str(),utf8str.c_str()+utf8str.size(),&wstr[0]);
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue