fix more issues reported by coverity

This commit is contained in:
David Hrdlička
2020-01-15 18:48:22 +01:00
parent 94ba8ec38c
commit a575bd7e8b
9 changed files with 23 additions and 13 deletions

View File

@@ -125,9 +125,11 @@ image_is_hdx(const wchar_t *s, int check_signature)
f = plat_fopen((wchar_t *)s, L"rb");
if (!f)
return 0;
fseeko64(f, 0, SEEK_END);
if (fseeko64(f, 0, SEEK_END))
fatal("image_is_hdx(): Error while seeking");
filelen = ftello64(f);
fseeko64(f, 0, SEEK_SET);
if (fseeko64(f, 0, SEEK_SET))
fatal("image_is_hdx(): Error while seeking");
if (filelen < 44) {
if (f != NULL)
fclose(f);

View File

@@ -530,7 +530,7 @@ zip_load(zip_t *dev, wchar_t *fn)
if (fseek(dev->drv->f, dev->drv->base, SEEK_SET) == -1)
fatal("zip_load(): Error seeking to the beginning of the file\n");
memcpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path));
wcsncpy(dev->drv->image_path, fn, sizeof_w(dev->drv->image_path));
return 1;
}