Fix potential bugs and two warnings relating to them

Memset doesn't automatically set the entire size of each element, it's necessary to multiply by sizeof(<typename>) if it's larger than 1 byte, which in this case, u16, is (two bytes).
This commit is contained in:
thedax
2017-09-06 05:01:42 -04:00
parent 80b9aa9cdb
commit 34ede05b93

View File

@@ -68,14 +68,14 @@ Result get_splashes(Splash_s** splashes_list, int *splash_count)
u32 bytes = file_to_buf(fsMakePath(PATH_UTF16, top_path), ArchiveSD, &temp_buf); u32 bytes = file_to_buf(fsMakePath(PATH_UTF16, top_path), ArchiveSD, &temp_buf);
if (!bytes) if (!bytes)
{ {
memset(top_path, 0, 0x106); memset(top_path, 0, 0x106 * sizeof(u16));
} }
free(temp_buf); free(temp_buf);
temp_buf = NULL; temp_buf = NULL;
bytes = file_to_buf(fsMakePath(PATH_UTF16, bottom_path), ArchiveSD, &temp_buf); bytes = file_to_buf(fsMakePath(PATH_UTF16, bottom_path), ArchiveSD, &temp_buf);
if (!bytes) if (!bytes)
{ {
memset(bottom_path, 0, 0x106); memset(bottom_path, 0, 0x106 * sizeof(u16));
} }
free(temp_buf); free(temp_buf);
memcpy(current_splash->name, entry.name, 0x106); memcpy(current_splash->name, entry.name, 0x106);