Date: Thu, 19 Aug 2010 01:34:01 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211475 - head/usr.bin/gzip Message-ID: <201008190134.o7J1Y1lV085780@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Thu Aug 19 01:34:00 2010 New Revision: 211475 URL: http://svn.freebsd.org/changeset/base/211475 Log: Check return value of dup(), it could be -1 when the system is running out of file descriptors for instance. Found with: Coverity Prevent(tm) CID: 6084 MFC after: 1 month Modified: head/usr.bin/gzip/unpack.c Modified: head/usr.bin/gzip/unpack.c ============================================================================== --- head/usr.bin/gzip/unpack.c Wed Aug 18 22:06:43 2010 (r211474) +++ head/usr.bin/gzip/unpack.c Thu Aug 19 01:34:00 2010 (r211475) @@ -312,7 +312,14 @@ unpack(int in, int out, char *pre, size_ { unpack_descriptor_t unpackd; - unpack_parse_header(dup(in), dup(out), pre, prelen, bytes_in, &unpackd); + in = dup(in); + if (in == -1) + maybe_err("dup"); + out = dup(out); + if (out == -1) + maybe_err("dup"); + + unpack_parse_header(in, out, pre, prelen, bytes_in, &unpackd); unpack_decode(&unpackd, bytes_in); unpack_descriptor_fini(&unpackd);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008190134.o7J1Y1lV085780>