From: lteo Date: Sat, 11 Jan 2014 04:29:07 +0000 (+0000) Subject: Check the return value of fstat() in readmsg(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7dcdad2d62ef0050b63603e3eeb514c61292a9ea;p=openbsd Check the return value of fstat() in readmsg(). OK deraadt@ tedu@ --- diff --git a/usr.bin/signify/signify.c b/usr.bin/signify/signify.c index 903d1a3f840..03d38865293 100644 --- a/usr.bin/signify/signify.c +++ b/usr.bin/signify/signify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signify.c,v 1.28 2014/01/10 17:52:50 deraadt Exp $ */ +/* $OpenBSD: signify.c,v 1.29 2014/01/11 04:29:07 lteo Exp $ */ /* * Copyright (c) 2013 Ted Unangst * @@ -168,7 +168,8 @@ readmsg(const char *filename, unsigned long long *msglenp) int fd; fd = xopen(filename, O_RDONLY | O_NOFOLLOW, 0); - fstat(fd, &sb); + if (fstat(fd, &sb) == -1) + err(1, "fstat on %s", filename); msglen = sb.st_size; if (msglen > (1UL << 30)) errx(1, "msg too large in %s", filename);