Add sanity casts for 32/64 bit correctness

This commit is contained in:
gingerBill
2021-07-12 11:03:12 +01:00
parent ff2e5c3efe
commit 76707e1d2f
10 changed files with 66 additions and 48 deletions
+1 -1
View File
@@ -448,7 +448,7 @@ bool find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
auto version_bytes = (tools_file_size.QuadPart + 1) * 2; // Warning: This multiplication by 2 presumes there is no variable-length encoding in the wchars (wacky characters in the file could betray this expectation).
if (version_bytes > 0x7FFFFFFF) continue; // Avoid overflow.
wchar_t *version = (wchar_t *)calloc(1, version_bytes);
wchar_t *version = (wchar_t *)calloc(1, (usize)version_bytes);
defer (free(version));
auto read_result = fgetws(version, (int)version_bytes, f);