summaryrefslogtreecommitdiff
path: root/rdoff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2017-04-17 14:22:32 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2017-04-17 14:22:32 -0700
commit6edeb335f0d1adb4a052cfb23fd1aefa06f8c8bc (patch)
tree3d3546a6a79f1649507547f1f6f91ef609464bef /rdoff
parentf20f1878f5f5a9cc09ac8f6928cf384ef8f2336e (diff)
downloadnasm-6edeb335f0d1adb4a052cfb23fd1aefa06f8c8bc.tar.gz
rdflib.c: fix(?) one more unsafe use of fread()
It isn't 100% clear what is the right thing to do in this particular case, so this is my best attempt... Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'rdoff')
-rw-r--r--rdoff/rdflib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rdoff/rdflib.c b/rdoff/rdflib.c
index 79a2085b..ee7f19f6 100644
--- a/rdoff/rdflib.c
+++ b/rdoff/rdflib.c
@@ -370,7 +370,9 @@ int main(int argc, char **argv)
/* check against desired name */
if (!strcmp(buf, argv[3])) {
- fread(p = rdbuf, 1, sizeof(rdbuf), fptmp);
+ if (fread(p = rdbuf, 1, sizeof(rdbuf), fptmp) < 10) {
+ nasm_fatal(0, "short read on input");
+ }
l = *(int32_t *)(p + 6);
fseek(fptmp, l, SEEK_CUR);
break;