]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: Don't Panic
authorVMware, Inc <>
Thu, 24 Feb 2011 22:46:53 +0000 (14:46 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 22:46:53 +0000 (14:46 -0800)
More UTF8 conversion panic protection.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/file/filePosix.c

index 6cbbec0f87053020ddc7370f39701f8c685f9f3d..230eeb3b56544659be2063491aa15f509da9cdf3 100644 (file)
@@ -2331,6 +2331,14 @@ File_ListDirectory(ConstUnicode pathName,  // IN:
                                    STRING_ENCODING_DEFAULT)) {
             id = Unicode_Alloc(entry->d_name, STRING_ENCODING_DEFAULT);
          } else {
+            id = Unicode_EscapeBuffer(entry->d_name, -1,
+                                     STRING_ENCODING_DEFAULT);
+
+            Warning("%s: file '%s' in directory '%s' cannot be converted to "
+                    "UTF8\n", __FUNCTION__, pathName, id);
+
+            Unicode_Free(id);
+
             id = Unicode_Duplicate("\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD");
          }