From owner-svn-src-all@FreeBSD.ORG Tue Jul 2 17:17:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E709D15B; Tue, 2 Jul 2013 17:17:42 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D97E71B4A; Tue, 2 Jul 2013 17:17:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r62HHgZ1015025; Tue, 2 Jul 2013 17:17:42 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r62HHg9f015024; Tue, 2 Jul 2013 17:17:42 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201307021717.r62HHg9f015024@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 2 Jul 2013 17:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252513 - head/gnu/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 02 Jul 2013 17:17:43 -0000 Author: obrien Date: Tue Jul 2 17:17:42 2013 New Revision: 252513 URL: http://svnweb.freebsd.org/changeset/base/252513 Log: Properly handle input lines containing NUL characters such that pgets() accurately fills the read buffer. Callers of pgets() still mis-process the buffer contents if the read line contains NUL characters, but this at least makes pgets() accurate. Modified: head/gnu/usr.bin/patch/pch.c Modified: head/gnu/usr.bin/patch/pch.c ============================================================================== --- head/gnu/usr.bin/patch/pch.c Tue Jul 2 17:09:57 2013 (r252512) +++ head/gnu/usr.bin/patch/pch.c Tue Jul 2 17:17:42 2013 (r252513) @@ -1181,7 +1181,7 @@ pgets(bool do_indent) indent++; } } - Strncpy(buf, line, len - skipped); + memcpy(buf, line, len - skipped); buf[len - skipped] = '\0'; } return len;