From cb711f6d5d029298892bd1ad508619f6bb7f25d7 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Thu, 15 Nov 2012 15:05:57 +0000 Subject: [PATCH] Add a missing check for fread Approved by: cperciva MFC after: 3 days --- usr.sbin/ndiscvt/ndiscvt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/ndiscvt/ndiscvt.c b/usr.sbin/ndiscvt/ndiscvt.c index 3775a3390817..7636c4c75059 100644 --- a/usr.sbin/ndiscvt/ndiscvt.c +++ b/usr.sbin/ndiscvt/ndiscvt.c @@ -325,6 +325,8 @@ main(int argc, char *argv[]) rewind (fp); img = calloc(fsize, 1); n = fread (img, fsize, 1, fp); + if (n == 0) + err(1, "reading .SYS file '%s' failed", sysfile); fclose(fp);