Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 2010 00:44:55 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r212807 - stable/8/usr.bin/gzip
Message-ID:  <201009180044.o8I0it3f046933@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sat Sep 18 00:44:55 2010
New Revision: 212807
URL: http://svn.freebsd.org/changeset/base/212807

Log:
  MFC r211475:
  
  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

Modified:
  stable/8/usr.bin/gzip/unpack.c
Directory Properties:
  stable/8/usr.bin/gzip/   (props changed)

Modified: stable/8/usr.bin/gzip/unpack.c
==============================================================================
--- stable/8/usr.bin/gzip/unpack.c	Fri Sep 17 23:09:31 2010	(r212806)
+++ stable/8/usr.bin/gzip/unpack.c	Sat Sep 18 00:44:55 2010	(r212807)
@@ -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?201009180044.o8I0it3f046933>