diff options
author | Nathan Binkert <nate@binkert.org> | 2008-09-19 09:11:42 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-09-19 09:11:42 -0700 |
commit | ea83cedcf625c35ddc6fe6b9390cdd1cca6b2039 (patch) | |
tree | 083da1af8d314dcb20a8d2f76c088247e5416bbf /src/base/loader/hex_file.cc | |
parent | f066db7fcd49d2234178e5d80db9278c798d9ba8 (diff) | |
download | gem5-ea83cedcf625c35ddc6fe6b9390cdd1cca6b2039.tar.xz |
Check the return value of I/O operations for failure
Diffstat (limited to 'src/base/loader/hex_file.cc')
-rwxr-xr-x | src/base/loader/hex_file.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/base/loader/hex_file.cc b/src/base/loader/hex_file.cc index 17347531e..61d6c8009 100755 --- a/src/base/loader/hex_file.cc +++ b/src/base/loader/hex_file.cc @@ -65,7 +65,9 @@ HexFile::loadSections(Port *memPort) Addr MemAddr; uint32_t Data; while (!feof(fp)) { - fgets(Line, 64, fp); + char *ret = fgets(Line, sizeof(Line), fp); + if (!ret) + panic("malformed file"); parseLine(Line, &MemAddr, &Data); if (MemAddr != 0) { // Now, write to memory |