From owner-svn-src-all@FreeBSD.ORG Fri Jan 4 11:11:13 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5188922E; Fri, 4 Jan 2013 11:11:13 +0000 (UTC) (envelope-from davidxu@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 428E0C41; Fri, 4 Jan 2013 11:11:13 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r04BBD7G013381; Fri, 4 Jan 2013 11:11:13 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r04BBDjZ013380; Fri, 4 Jan 2013 11:11:13 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201301041111.r04BBDjZ013380@svn.freebsd.org> From: David Xu Date: Fri, 4 Jan 2013 11:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245036 - head/sys/kern 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: Fri, 04 Jan 2013 11:11:13 -0000 Author: davidxu Date: Fri Jan 4 11:11:12 2013 New Revision: 245036 URL: http://svnweb.freebsd.org/changeset/base/245036 Log: Revert revision 244760 because strncpy pads trailing space with zero, this prevents kernel data from being leaked. Noticed by: Joerg Sonnenberger < joerg at britannica dot bec dot de > Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Fri Jan 4 09:52:09 2013 (r245035) +++ head/sys/kern/vfs_mount.c Fri Jan 4 11:11:12 2013 (r245036) @@ -559,7 +559,7 @@ vfs_donmount(struct thread *td, uint64_t if (error || fstype[fstypelen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) - strlcpy(errmsg, "Invalid fstype", errmsg_len); + strncpy(errmsg, "Invalid fstype", errmsg_len); goto bail; } fspathlen = 0; @@ -567,7 +567,7 @@ vfs_donmount(struct thread *td, uint64_t if (error || fspath[fspathlen - 1] != '\0') { error = EINVAL; if (errmsg != NULL) - strlcpy(errmsg, "Invalid fspath", errmsg_len); + strncpy(errmsg, "Invalid fspath", errmsg_len); goto bail; } @@ -1447,7 +1447,7 @@ vfs_filteropt(struct vfsoptlist *opts, c if (ret != 0) { TAILQ_FOREACH(opt, opts, link) { if (strcmp(opt->name, "errmsg") == 0) { - strlcpy((char *)opt->value, errmsg, opt->len); + strncpy((char *)opt->value, errmsg, opt->len); break; } }