Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 2015 07:14:18 +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-10@freebsd.org
Subject:   svn commit: r290854 - stable/10/usr.sbin/pw
Message-ID:  <201511150714.tAF7EIEF045501@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Sun Nov 15 07:14:17 2015
New Revision: 290854
URL: https://svnweb.freebsd.org/changeset/base/290854

Log:
  MFC r290174:
  
  In pw_userlock, set 'name' to NULL when we encounter an all number string
  because it is also used as an indicator of whether a name or an UID is
  being used and we may have undefined results as 'name' may contain
  uninitialized stack contents.

Modified:
  stable/10/usr.sbin/pw/pw_user.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/pw_user.c
==============================================================================
--- stable/10/usr.sbin/pw/pw_user.c	Sun Nov 15 07:10:02 2015	(r290853)
+++ stable/10/usr.sbin/pw/pw_user.c	Sun Nov 15 07:14:17 2015	(r290854)
@@ -280,9 +280,10 @@ pw_userlock(char *arg1, int mode)
 	if (arg1 == NULL)
 		errx(EX_DATAERR, "username or id required");
 
-	if (arg1[strspn(arg1, "0123456789")] == '\0')
+	if (arg1[strspn(arg1, "0123456789")] == '\0') {
 		id = pw_checkid(arg1, UID_MAX);
-	else
+		name = NULL;
+	} else
 		name = arg1;
 
 	pwd = (name != NULL) ? GETPWNAM(pw_checkname(name, 0)) : GETPWUID(id);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511150714.tAF7EIEF045501>