usr.sbin/makefs/cd9660/cd9660_eltorito.c CID 975347 : Unchecked return value from library (CHECKED_RETURN) 5. check_return: Calling fseek(fd, 32UL - strlen(part_type) - 1UL, 1) without checking return value. 575 fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR); CID 975348: Unchecked return value from library (CHECKED_RETURN) 33. check_return: Calling fseek(fd, 510L, 0) without checking return 639 fseek(fd, 0x1fe, SEEK_SET); (Ouch, an ISO producer which does not work on sequential file objects. That's quite inconvenient for users.) --------------- Source analysis: There are three fseek() with unchecked result: In cd9660_write_apm_partition_entry(): 573 fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); 575 fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR); In cd9660_write_boot(): 639 fseek(fd, 0x1fe, SEEK_SET); Failed fseeko() is handled by calling err(), which exits the process: 554 if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1) 555 err(1, "fseeko"); --------------- Remedy proposal: Bail out by err(), too: - fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR); + if (fseek(fd, 32 - strlen(part_name) - 1, SEEK_CUR) == -1) + err(1, "fseek for APM partition"); - fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR); + if (fseek(fd, 32 - strlen(part_type) - 1, SEEK_CUR) == -1) + err(1, "fseek for APM partition"); - fseek(fd, 0x1fe, SEEK_SET); + if (fseek(fd, 0x1fe, SEEK_SET) == -1) + err(1, "fseek for MBR partition");
Bulk taking makefs bugs.
Releasing bugs back to the pool.