diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-21 02:03:56 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-21 02:03:56 +0200 |
commit | b9573a485baf98e9fb749289b8b9c1f73f70d280 (patch) | |
tree | 55f0a98a827a071860ebe4400f20beca34cf4c0c | |
parent | 1c35b863b47b558a1b2e7f2f4673643b4f0128d4 (diff) | |
download | EpisodeBrowser-b9573a485baf98e9fb749289b8b9c1f73f70d280.tar.gz |
Fix memory bug.
-rw-r--r-- | c/data.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -72,8 +72,8 @@ template <size_t N> bool WcharsFromXmlchars(wchar_t (&dst)[N], XmlCharPtr utf8) { /* Truncate if source is larger than destination. */ - utf8[N] = 0; int lenUtf8 = xmlStrlen(utf8); + utf8[std::min(N, static_cast<size_t>(lenUtf8))] = 0; /* Convert internal representation from UTF-8 to Latin-1, * which seems to actually convert the string to proper UTF-8 |