From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 12 06:56:52 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3092C106566C; Fri, 12 Mar 2010 06:56:52 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 217488FC08; Fri, 12 Mar 2010 06:56:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2C6uqNr022869; Fri, 12 Mar 2010 06:56:52 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2C6uqQD022867; Fri, 12 Mar 2010 06:56:52 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003120656.o2C6uqQD022867@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 12 Mar 2010 06:56:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205070 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 06:56:52 -0000 Author: jh Date: Fri Mar 12 06:56:51 2010 New Revision: 205070 URL: http://svn.freebsd.org/changeset/base/205070 Log: MFC r204447: In _gettemp(), check that the length of the path doesn't exceed MAXPATHLEN. Otherwise the path name (or part of it) may not fit to carrybuf causing a buffer overflow. PR: bin/140228 Modified: stable/8/lib/libc/stdio/mktemp.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/stdio/mktemp.c ============================================================================== --- stable/8/lib/libc/stdio/mktemp.c Fri Mar 12 06:31:19 2010 (r205069) +++ stable/8/lib/libc/stdio/mktemp.c Fri Mar 12 06:56:51 2010 (r205070) @@ -116,6 +116,10 @@ _gettemp(path, doopen, domkdir, slen) for (trv = path; *trv != '\0'; ++trv) ; + if (trv - path >= MAXPATHLEN) { + errno = ENAMETOOLONG; + return (0); + } trv -= slen; suffp = trv; --trv;