Skip to content

Commit

Permalink
Fix strings termination
Browse files Browse the repository at this point in the history
  • Loading branch information
unxed committed Jun 23, 2020
1 parent 8ff9fea commit b492f5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Binary file modified p7zip_16.02_oemcpauto.tar.gz
Binary file not shown.
8 changes: 5 additions & 3 deletions p7zip_oemcp_ZipItem.cpp.patch
Expand Up @@ -9,7 +9,7 @@
#include "StdAfx.h"

#include "../../../../C/CpuArch.h"
@@ -244,6 +249,167 @@
@@ -244,6 +249,169 @@
#endif
}

Expand Down Expand Up @@ -164,9 +164,11 @@
+ const char* src = s.Ptr();
+ size_t slen = s.Len();
+ size_t dlen = slen * 4;
+ const char* dest = s_utf8.GetBuf_SetEnd(dlen);
+ const char* dest = s_utf8.GetBuf_SetEnd(dlen + 1); // (source length * 4) + null termination
+
+ size_t done = iconv(cd, (char**)&src, &slen, (char**)&dest, &dlen);
+ bzero((size_t*)dest + done, 1);
+
+ iconv(cd, (char**)&src, &slen, (char**)&dest, &dlen);
+ iconv_close(cd);
+
+ if (ConvertUTF8ToUnicode(s_utf8, res) || ignore_Utf8_Errors)
Expand Down

0 comments on commit b492f5a

Please sign in to comment.