[Bug 205157] [patch] pw(8) does not accept 8-bit characters in a GECOS field

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Dec 9 13:22:51 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205157

            Bug ID: 205157
           Summary: [patch] pw(8) does not accept 8-bit characters in a
                    GECOS field
           Product: Base System
           Version: 10.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: orios814 at gmail.com
          Keywords: patch

Created attachment 164014
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=164014&action=edit
A patch to make pw(8) accept 8-bit characters in a GECOS field.

The command pw(8) does not accept 8-bit characters in a GECOS field, though
'pw_user.c' claims at line 1238 that 8-bit characters are intended to be
allowed in a GECOS field.

[How-To-Repeat] Try the following command on your shell.
# pw useradd foobar -c '<some 8-bit characters>'

[Reason] The function 'pw_checkname' in '/usr/src/usr.sbin/pw/pw_user.c' checks
if the input string does not have characters of 0x00--0x1F at line 1233 by the
following condition:
  *ch < ' '
However, the type of 'ch' was changed from 'u_char' to 'char' (Jul. 3, 2015),
which made the above condition match also characters 0x80--0xFF. So the
condition must be the following:
  (*ch >= 0 && *ch < ' ')

The attached patch for '/usr/src/usr.sbin/pw/pw_user.c' will fix this problem.

Thank you for reading!

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list