Bug 126858 - Too long /proc/X/cmdline: bad ps output when piped to less/more
Summary: Too long /proc/X/cmdline: bad ps output when piped to less/more
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: telnet
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-28 14:23 UTC by giulioo
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-28 19:49:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:327 0 important SHIPPED_LIVE Important: telnet security update 2005-03-28 05:00:00 UTC

Description giulioo 2004-06-28 14:23:32 UTC
Description of problem:
It seems that telnetd/setproctitle.c sets up a string long as args +
environment, then it proceeds to fill with blanks what's after the
last useful chars (ie: hostname).

The primary effect of this is that /proc/X/cmdline has many blanks at
the end (espacially if you have a bing environment)

The side effect of this is that when you do "ps ax|less", "ps ax|more"
(but not simple "ps ax" or "ps ax > file") output will look like

Version-Release number of selected component (if applicable):
telnet-server-0.17-26


How reproducible:
Always


Steps to Reproduce:
1. "ps ax|less"
2. look at the output

Actual Results (blank lines in output): 
========
 1117 ?        SW     0:00 [kjournald]
13127 ?        S      0:00 in.telnetd: myhost
 
 
 
13128 ?        S      0:00 login -- mylogin
=========

Expected Results: 
=========
 1117 ?        SW     0:00 [kjournald]
13127 ?        S      0:00 in.telnetd: myhost
13128 ?        S      0:00 login -- mylogin
==========


Additional info:

Possible solution (the one involving minimal code modification):

--- telnetd/setproctitle.c.orig 2004-06-24 19:47:44.000000000 +0200
+++ telnetd/setproctitle.c      2004-06-24 19:47:56.000000000 +0200
@@ -139,7 +139,7 @@
        (void) strcpy(Argv[0], buf);
        p = &Argv[0][i];
        while (p < LastArgv)
-               *p++ = ' ';
+               *p++ = '\0';
        Argv[1] = NULL;
 }

Comment 1 Harald Hoyer 2004-06-28 14:53:28 UTC
good point! Thx!

Comment 2 Josh Bressers 2005-03-28 19:49:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-327.html



Note You need to log in before you can comment on or make changes to this bug.