diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index bb42849a..bd57ed94 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -785,6 +785,10 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, r = WideCharToMultiByte(to_cp, 0, ws, (int)wslen, as->s + as->length, (int)(as->buffer_length - as->length - 1), NULL, dp); + if (r == 0 && wslen == 0) { + count = 0; + break; + } if (r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { /* Expand the MBS buffer and retry. */ diff --git a/tar/test/test_option_ignore_zeros.c b/tar/test/test_option_ignore_zeros.c index 453e8a09..926af2c8 100644 --- a/tar/test/test_option_ignore_zeros.c +++ b/tar/test/test_option_ignore_zeros.c @@ -70,13 +70,6 @@ DEFINE_TEST(test_option_ignore_zeros_mode_x) DEFINE_TEST(test_option_ignore_zeros_mode_c) { -#if defined(_WIN32) && !defined(__CYGWIN__) - // The first command run by systemf below prints this to stderr: - // bsdtar.exe: a: Can't translate uname '(null)' to UTF-8 - // bsdtar.exe: b: Can't translate uname '(null)' to UTF-8 - skipping("TODO: figure out why this test fails on github workflows with MSVC"); - return; -#else if (make_files()) return; @@ -96,7 +89,6 @@ DEFINE_TEST(test_option_ignore_zeros_mode_c) assertEqualFile("out/a", "in/a"); assertEqualFile("out/b", "in/b"); assertEqualFile("out/c", "in/c"); -#endif } static void