Skip to content

Commit

Permalink
apply fix from #112 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
unxed committed May 22, 2024
1 parent 64c0aa7 commit 4815bda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CPP/7zip/Archive/Zip/ZipItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo

size_t dlen = slen * 4 + 1; // (source length * 4) + null termination
char* dst = s_utf8.GetBuf_SetEnd(dlen);
const char* dstStart = dst;

memset(dst, 0, dlen);

Expand All @@ -593,9 +594,11 @@ void CItem::GetUnicodeString(UString &res, const AString &s, bool isComment, boo

iconv_close(cd);

if (ConvertUTF8ToUnicode(s_utf8, res) /*|| ignore_Utf8_Errors*/) {
AString sUtf8CorrectLength;
unsigned dstCorrectLength = dst - dstStart;
sUtf8CorrectLength.SetFrom(sUtf8, dstCorrectLength);
if (ConvertUTF8ToUnicode(sUtf8CorrectLength, res) /*|| ignore_Utf8_Errors*/)
return;
}
}
}
}
Expand Down

0 comments on commit 4815bda

Please sign in to comment.