[misc] fix some Coverity warnings

This commit is contained in:
Pete Batard 2021-08-02 13:22:49 +01:00
parent 436584fcc0
commit 8538ce0590
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
7 changed files with 14 additions and 9 deletions

View file

@ -1526,9 +1526,11 @@ BOOL DumpFatDir(const char* path, int32_t cluster)
written = 0;
s = libfat_clustertosector(lf_fs, dirpos.cluster);
while ((s != 0) && (s < 0xFFFFFFFFULL) && (written < diritem.size)) {
buf = libfat_get_sector(lf_fs, s);
if (buf == NULL)
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_SECTOR_NOT_FOUND;
if (FormatStatus)
goto out;
buf = libfat_get_sector(lf_fs, s);
size = MIN(LIBFAT_SECTOR_SIZE, diritem.size - written);
if (!WriteFileWithRetry(handle, buf, size, &size, WRITE_RETRIES) ||
(size != MIN(LIBFAT_SECTOR_SIZE, diritem.size - written))) {