From owner-svn-src-all@FreeBSD.ORG Fri Mar 19 12:04:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A713106564A; Fri, 19 Mar 2010 12:04:57 +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 387888FC3E; Fri, 19 Mar 2010 12:04:57 +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 o2JC4u08041968; Fri, 19 Mar 2010 12:04:56 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2JC4uIx041966; Fri, 19 Mar 2010 12:04:56 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003191204.o2JC4uIx041966@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 19 Mar 2010 12:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205330 - stable/7/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 12:04:57 -0000 Author: jh Date: Fri Mar 19 12:04:56 2010 New Revision: 205330 URL: http://svn.freebsd.org/changeset/base/205330 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/7/lib/libc/stdio/mktemp.c Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/stdio/mktemp.c ============================================================================== --- stable/7/lib/libc/stdio/mktemp.c Fri Mar 19 11:59:02 2010 (r205329) +++ stable/7/lib/libc/stdio/mktemp.c Fri Mar 19 12:04:56 2010 (r205330) @@ -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;