summaryrefslogtreecommitdiff
path: root/rdoff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-04-17 14:25:13 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2017-04-17 14:25:13 -0700
commit84deac219db1b0b8c9df53d9b81ac0b5ca7578e6 (patch)
tree1148bff6a3831b1e3c5e1bd4a5c50bf461402dc5 /rdoff
parent6edeb335f0d1adb4a052cfb23fd1aefa06f8c8bc (diff)
downloadnasm-84deac219db1b0b8c9df53d9b81ac0b5ca7578e6.tar.gz
rdoff.c: one more unsafe use of fread()
Use the same error pattern as the rest of the calls in this function. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'rdoff')
-rw-r--r--rdoff/rdoff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rdoff/rdoff.c b/rdoff/rdoff.c
index a015acdc..77fec399 100644
--- a/rdoff/rdoff.c
+++ b/rdoff/rdoff.c
@@ -275,7 +275,11 @@ int rdfopenhere(rdffile * f, FILE * fp, int *refcount, const char *name)
f->fp = fp;
initpos = ftell(fp);
- fread(buf, 6, 1, f->fp); /* read header */
+ /* read header */
+ if (fread(buf, 1, 6, f->fp) != 6) {
+ fclose(f->fp);
+ return rdf_errno = RDF_ERR_READ;
+ }
buf[6] = 0;
if (strcmp(buf, RDOFFId)) {