Merge pull request #1501 from iij/pr_fix_read_debug_section

Fix checking return value of fread()
This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-09-12 01:42:56 -07:00
+1 -1
View File
@@ -734,7 +734,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
else if (memcmp(section_header.section_identify, RITE_SECTION_DEBUG_IDENTIFIER, sizeof(section_header.section_identify)) == 0) {
uint8_t* const bin = mrb_malloc(mrb, section_size);
fseek(fp, fpos, SEEK_SET);
if(fread((char*)bin, section_size, 1, fp) != section_size) {
if(fread((char*)bin, section_size, 1, fp) != 1) {
mrb_free(mrb, bin);
return MRB_DUMP_READ_FAULT;
}