From nobody@FreeBSD.org  Wed Aug 29 21:08:34 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 69A2B106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Aug 2012 21:08:34 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 5506C8FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Aug 2012 21:08:34 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TL8Yv9087266
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 29 Aug 2012 21:08:34 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q7TL8Ym4087265;
	Wed, 29 Aug 2012 21:08:34 GMT
	(envelope-from nobody)
Message-Id: <201208292108.q7TL8Ym4087265@red.freebsd.org>
Date: Wed, 29 Aug 2012 21:08:34 GMT
From: Devin Teske <dteske@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ps(1) shows bad error message with specific arguments
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         171174
>Category:       bin
>Synopsis:       ps(1) shows bad error message with specific arguments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    emaste
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 29 21:10:01 UTC 2012
>Closed-Date:    Wed Sep 05 02:27:29 UTC 2012
>Last-Modified:  Wed Sep  5 02:30:02 UTC 2012
>Originator:     Devin Teske
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
FIS Global, Inc.
>Environment:
FreeBSD ref10-amd64.freebsd.org 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r231914: Sun Feb 19 17:24:37 UTC 2012     bz@glide.freebsd.org:/usr/obj/scratch/src/sys/GLIDE  amd64
>Description:
Executing "ps -p ''" produces an appropriate error message (shown below):

ps: Invalid (zero-length) process id

However, when one executes instead "ps -o ucomm -p ''", the error message contains a corrupted string (shown below):

ps: Invalid process id: Pf
>How-To-Repeat:
Use the "-o" flag with any value in conjunction with "-p" passed a NULL (zero-length) argument.
>Fix:


>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/171174: commit references a PR
Date: Wed, 29 Aug 2012 21:38:44 +0000 (UTC)

 Author: emaste
 Date: Wed Aug 29 21:38:34 2012
 New Revision: 239883
 URL: http://svn.freebsd.org/changeset/base/239883
 
 Log:
   Avoid passing uninitialized stack to addelem() if called with an empty arg.
   
   PR:		bin/171174
 
 Modified:
   head/bin/ps/ps.c
 
 Modified: head/bin/ps/ps.c
 ==============================================================================
 --- head/bin/ps/ps.c	Wed Aug 29 21:12:19 2012	(r239882)
 +++ head/bin/ps/ps.c	Wed Aug 29 21:38:34 2012	(r239883)
 @@ -889,8 +889,8 @@ add_list(struct listinfo *inf, const cha
  	int toolong;
  	char elemcopy[PATH_MAX];
  
 -	if (*argp == 0)
 -		inf->addelem(inf, elemcopy);
 +	if (*argp == '\0')
 +		inf->addelem(inf, argp);
  	while (*argp != '\0') {
  		while (*argp != '\0' && strchr(W_SEP, *argp) != NULL)
  			argp++;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: emaste 
State-Changed-When: Wed Aug 29 23:16:20 UTC 2012 
State-Changed-Why:  
Fix committed as 239883 


Responsible-Changed-From-To: freebsd-bugs->emaste 
Responsible-Changed-By: emaste 
Responsible-Changed-When: Wed Aug 29 23:16:20 UTC 2012 
Responsible-Changed-Why:  
Grab 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171174 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/171174: commit references a PR
Date: Wed,  5 Sep 2012 02:03:58 +0000 (UTC)

 Author: emaste
 Date: Wed Sep  5 02:03:43 2012
 New Revision: 240123
 URL: http://svn.freebsd.org/changeset/base/240123
 
 Log:
   MFC 239883:
   
     Avoid passing uninitialized stack to addelem() if called with an empty
     arg.
   
   PR: bin/171174
 
 Modified:
   stable/9/bin/ps/ps.c
 Directory Properties:
   stable/9/bin/ps/   (props changed)
 
 Modified: stable/9/bin/ps/ps.c
 ==============================================================================
 --- stable/9/bin/ps/ps.c	Tue Sep  4 23:27:07 2012	(r240122)
 +++ stable/9/bin/ps/ps.c	Wed Sep  5 02:03:43 2012	(r240123)
 @@ -889,8 +889,8 @@ add_list(struct listinfo *inf, const cha
  	int toolong;
  	char elemcopy[PATH_MAX];
  
 -	if (*argp == 0)
 -		inf->addelem(inf, elemcopy);
 +	if (*argp == '\0')
 +		inf->addelem(inf, argp);
  	while (*argp != '\0') {
  		while (*argp != '\0' && strchr(W_SEP, *argp) != NULL)
  			argp++;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: emaste 
State-Changed-When: Wed Sep 5 02:26:33 UTC 2012 
State-Changed-Why:  
MFC'd to stable/9 as r240123 and stable/8 as r240124. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171174 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/171174: commit references a PR
Date: Wed,  5 Sep 2012 02:26:25 +0000 (UTC)

 Author: emaste
 Date: Wed Sep  5 02:26:13 2012
 New Revision: 240124
 URL: http://svn.freebsd.org/changeset/base/240124
 
 Log:
   MFC 239883:
   
     Avoid passing uninitialized stack to addelem() if called with an empty
     arg.
   
   PR: bin/171174
 
 Modified:
   stable/8/bin/ps/ps.c
 Directory Properties:
   stable/8/bin/ps/   (props changed)
 
 Modified: stable/8/bin/ps/ps.c
 ==============================================================================
 --- stable/8/bin/ps/ps.c	Wed Sep  5 02:03:43 2012	(r240123)
 +++ stable/8/bin/ps/ps.c	Wed Sep  5 02:26:13 2012	(r240124)
 @@ -857,8 +857,8 @@ add_list(struct listinfo *inf, const cha
  	int toolong;
  	char elemcopy[PATH_MAX];
  
 -	if (*argp == 0)
 -		inf->addelem(inf, elemcopy);
 +	if (*argp == '\0')
 +		inf->addelem(inf, argp);
  	while (*argp != '\0') {
  		while (*argp != '\0' && strchr(W_SEP, *argp) != NULL)
  			argp++;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
