]> wimlib.net Git - wimlib/blobdiff - src/integrity.c
Various portability fixes
[wimlib] / src / integrity.c
index f1e208f17d2a4a1fc26363ddba8580a8aae55b90..f9d7aaa57fd9ae7a18f0c0e555d6cf42666a314c 100644 (file)
@@ -144,10 +144,12 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
        }
 
        /* Read the integrity table into memory. */
        }
 
        /* Read the integrity table into memory. */
-       buf = MALLOC(res_entry->original_size);
-       if (!buf) {
+       if ((sizeof(size_t) < sizeof(u64)
+           && res_entry->original_size > ~(size_t)0)
+           || ((buf = MALLOC(res_entry->original_size)) == NULL))
+       {
                ERROR("Out of memory (needed %zu bytes for integrity table)",
                ERROR("Out of memory (needed %zu bytes for integrity table)",
-                     res_entry->original_size);
+                     (size_t)res_entry->original_size);
                ret = WIMLIB_ERR_NOMEM;
                goto out;
        }
                ret = WIMLIB_ERR_NOMEM;
                goto out;
        }