diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2017-04-17 14:25:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2017-04-17 14:25:13 -0700 |
commit | 84deac219db1b0b8c9df53d9b81ac0b5ca7578e6 (patch) | |
tree | 1148bff6a3831b1e3c5e1bd4a5c50bf461402dc5 /rdoff | |
parent | 6edeb335f0d1adb4a052cfb23fd1aefa06f8c8bc (diff) | |
download | nasm-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.c | 6 |
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)) { |