From nobody@FreeBSD.org  Mon Sep  2 00:53:48 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6C39237B400
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 Sep 2002 00:53:48 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D1C0143E72
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 Sep 2002 00:53:47 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g827rlOT082772
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 2 Sep 2002 00:53:47 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g827rlAT082771;
	Mon, 2 Sep 2002 00:53:47 -0700 (PDT)
Message-Id: <200209020753.g827rlAT082771@www.freebsd.org>
Date: Mon, 2 Sep 2002 00:53:47 -0700 (PDT)
From: Jay Chuang <jay@embeddedos.com.tw>
To: freebsd-gnats-submit@FreeBSD.org
Subject: chpass bug 
X-Send-Pr-Version: www-1.0

>Number:         42316
>Category:       i386
>Synopsis:       chpass bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 02 01:00:03 PDT 2002
>Closed-Date:    Mon Sep 02 01:13:51 PDT 2002
>Last-Modified:  Mon Sep 02 01:13:51 PDT 2002
>Originator:     Jay Chuang
>Release:        4.6.2
>Organization:
STEPTECH
>Environment:
FreeBSD jay.eflash.com.tw 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #7: Thu Aug 29 14:10:12 CST 2002     rd@jay.eflash.com.tw:/usr/src/sys/compile/KEVIN  i386

>Description:
      chpass bug 
>How-To-Repeat:
bug 1: source /usr/src/usr.sbin/vipw/pw_util.c
int
pw_tmp()
{
        static char path[MAXPATHLEN];
        int fd;
        char *p;

        if ((p = strrchr(masterpasswd, '/')) == NULL)
                strcpy(path, "pw.XXXXXX");
        else
                if (snprintf(path, sizeof path, "%.*s/pw.XXXXXX",
                    (int)(p - masterpasswd), masterpasswd) >= sizeof path)
                        errx(1, "%s: path too long", masterpasswd);
        if ((fd = mkstemp(path)) == -1)
                err(1, "%s", path);
        tempname = path;
        return (fd);
}

bug 2 : source  /usr/src/usr.bin/chpass/chpass.c

    210         if (op == LOADENTRY) {
    211                 if (uid)
    212                         baduser();
    213                 pw = &lpw;
    214                 if (!pw_scan(arg, pw))
    215                         exit(1);
    216         }

>Fix:
bug 1 Fix : change function strchr to strrch
bug 1 Fix : add "old_pw = *pw;" after line 215 
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: roam 
State-Changed-When: Mon Sep 2 01:13:27 PDT 2002 
State-Changed-Why:  
Duplicate of i386/42315. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42316 
>Unformatted:
