Browse Source

fpgautils: Check for fgets error

Luke Dashjr 12 years ago
parent
commit
699a5a19de
1 changed files with 2 additions and 1 deletions
  1. 2 1
      fpgautils.c

+ 2 - 1
fpgautils.c

@@ -1020,7 +1020,8 @@ bool load_bitstream_intelhex(bytes_t *rv, const char *dname, const char *fn)
 			applog(LOG_ERR, "Error reading '%s'", fn);
 			applog(LOG_ERR, "Error reading '%s'", fn);
 			goto ihxerr;
 			goto ihxerr;
 		}
 		}
-		fgets(buf, sizeof(buf), F);
+		if (!fgets(buf, sizeof(buf), F))
+			goto ihxerr;
 		if (unlikely(buf[0] != ':'))
 		if (unlikely(buf[0] != ':'))
 			goto ihxerr;
 			goto ihxerr;
 		if (unlikely(!(
 		if (unlikely(!(