* information about WIMBoot.
*
* Note that WIMBoot pointer files are actually implemented on top of the
- * Windows Overlay File System Filter (WOF). See wof.h for more info.
+ * Windows Overlay Filesystem filter (WOF). See wof.h for more info.
*/
/*
return 0;
}
+static bool
+valid_wim_filename(const struct WimOverlay_dat_entry_2 *entry, size_t name_len)
+{
+ size_t i;
+
+ if (name_len % sizeof(wchar_t))
+ return false;
+ name_len /= sizeof(wchar_t);
+ if (name_len < 2)
+ return false;
+ for (i = 0; i < name_len && entry->wim_file_name[i] != 0; i++)
+ ;
+ return i == name_len - 1;
+}
+
/*
* Reads and validates a WimOverlay.dat file.
*
wim_file_name_length = entry_1->entry_2_length -
sizeof(struct WimOverlay_dat_entry_2);
- if ((wim_file_name_length < 2 * sizeof(wchar_t)) ||
- (wim_file_name_length % sizeof(wchar_t) != 0) ||
- (wmemchr(entry_2->wim_file_name, L'\0',
- wim_file_name_length / sizeof(wchar_t))
- != &entry_2->wim_file_name[wim_file_name_length /
- sizeof(wchar_t) - 1]))
- {
+ if (!valid_wim_filename(entry_2, wim_file_name_length)) {
ERROR("\"%ls\": entry %"PRIu32" (2) "
"(data source ID 0x%016"PRIx64") "
"has invalid WIM file name",
FREE(in);
out:
if (ret == WIMLIB_ERR_UNSUPPORTED) {
- #if 0
- WARNING(
- "The version of Windows you are running does not appear to support\n"
- " the Windows Overlay File System Filter Driver. This is normally\n"
- " available on Windows 8.1 Update 1 or later. Therefore, wimlib\n"
- " will attempt to update the WimOverlay.dat file directly.\n");
- #else
WARNING("WOF driver is not available; updating WimOverlay.dat directly.");
- #endif
ret = update_wimoverlay_manually(drive_path + 4, wim_path,
wim_guid, image,
data_source_id_ret);