Debian bug report logs - #1337, boring messages


Message sent to debian-devel@pixar.com:


Subject: Bug#1337: Improper use of sscanf in procps
Reply-To: Herbert Xu <herbert@greathan.apana.org.au>, debian-bugs@pixar.com
Resent-From: Herbert Xu <herbert@greathan.apana.org.au>
Resent-To: debian-devel@pixar.com
Resent-Date: Sat, 09 Sep 1995 11:03:02 GMT
Resent-Message-ID: <debian-bugs-handler.1337.B09091101530@pixar.com>
Resent-Sender: iwj10@cus.cam.ac.uk
X-Debian-PR-Package: procps
X-Debian-PR-Keywords: 
Received: via spool for debian-bugs; Sat, 09 Sep 1995 11:03:02 GMT
Received: with rfc822 via encapsulated-mail; Sat, 09 Sep 1995 11:01:51 GMT
Received: from pixar.com by mongo.pixar.com with smtp
	(Smail3.1.28.1 #15) id m0srNeR-00052VC; Sat, 9 Sep 95 04:00 PDT
Received: from ion.apana.org.au by pixar.com with SMTP id AA07160
  (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Sat, 9 Sep 1995 04:00:27 -0700
Received: (from herbert@localhost) by greathan.apana.org.au (8.6.12/8.6.6) id UAA32665 for debian-bugs@pixar.com; Sat, 9 Sep 1995 20:46:40 +1000
From: Herbert Xu <herbert@greathan.apana.org.au>
Message-Id: <199509091046.UAA32665@greathan.apana.org.au>
To: debian-bugs@pixar.com
Date: Sat, 9 Sep 1995 20:46:31 +1000 (EST)
X-Mailer: ELM [version 2.4 PL24 PGP2]
Content-Type: text
Content-Length: 1298

Package: procps
Version: 0.97-4

Occasionally "ps -a" would display command lines incorrectly:

$ ps -a
  PID TTY STAT  TIME COMMAND
  197 v11 SW    0:00 (getty)
  198 v12 SW    0:00 (getty)
14360 v10 SW    0:00 (getty)
21795 v09 SW    3:50 (bash)
31647 s02 SW    0:01 (uugetty)map)

<..deleted..>

Of course, the last line should've been "(uugetty)".  The "map)" part
comes from "(rpc.portmap)".  This is caused by the use of "%40c" in
snap.c when calling sscanf().  Since "%40c" doesn't put a NUL at the
end of the string, any parts of a previously assigned value would
remain, as is the case here.  Here is a patch to fix it:

--- procps-0.97/snap.c.orig	Sat Sep  9 19:28:02 1995
+++ procps-0.97/snap.c	Sat Sep  9 19:45:33 1995
@@ -35,7 +35,7 @@
 	    ;
     *tmp='\0';
     /* Now we can parse these two strings separately */
-    sscanf(S, "%d %40c", &P->pid, P->cmd);
+    sscanf(S, "%d %39s", &P->pid, P->cmd);
     sscanf(tmp+1, "%c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u "
                   "%d %u %u %u %u %u %u %u %u %d %d %d %d %u",
            &P->state, &P->ppid, &P->pgrp, &P->session, &P->tty, &P->tpgid,

--
A.  B <=> True			B.  A <=> False
Email:  Herbert Xu ~{PmV>HI~} <herbert@greathan.apana.org.au>
PGP Key:  pgp-public-keys@pgp.mit.edu or any other key sites


Message sent:


From: iwj10@thor.cam.ac.uk (Ian Jackson)
To: Herbert Xu <herbert@greathan.apana.org.au>
Subject: Bug#1337: Acknowledgement (was: Improper use of sscanf in procps)
In-Reply-To: <199509091046.UAA32665@greathan.apana.org.au>
References: <199509091046.UAA32665@greathan.apana.org.au>

Thank you for the problem report you have sent regarding Debian GNU/Linux.
This is an automatically generated reply, to let you know your message has
been received.  It is being forwarded to the developers' mailing list for
their attention; they will reply in due course.

If you wish to submit further information on your problem, please send
it to debian-bugs@pixar.com, but please ensure that the Subject
line of your message starts with "Bug#1337" or "Re: Bug#1337" so that
we can identify it as relating to the same problem.

Please do not reply to the address at the top of this message,
unless you wish to report a problem with the bug-tracking system.

Ian Jackson
(maintainer, debian-bugs)


Message sent:


From: iwj10@thor.cam.ac.uk (Ian Jackson)
To: sr1@irz301.inf.tu-dresden.de (Sven Rudolph)
Subject: Bug#1337: Info received and FILED only (was Bug#1337: Improper use of sscanf in procps)
In-Reply-To: <199509272142.WAA21395@irz301.inf.tu-dresden.de>
References: <199509272142.WAA21395@irz301.inf.tu-dresden.de>

Thank you for the additional information you have supplied regarding this
problem report.  It has NOT been forwarded to the developers, as you
requested, but will accompany the original report in the bug tracking
system.  Please ensure that you yourself have sent a copy of the additional
information to any relevant developers or mailing lists.

If you wish to continue to submit further information on your problem,
please do the same thing again: send it to debian-bugs@pixar.com, ensuring
that the Subject line starts with "Bug#1337" or "Re: Bug#1337" so that
we can identify it as relating to the same problem.  Remember to specify
`X-Debian-PR: quiet' if this is apppropriate.

Please do not reply to the address at the top of this message,
unless you wish to report a problem with the bug-tracking system.

Ian Jackson
(maintainer, debian-bugs)


Message sent to debian-devel@pixar.com:


Subject: Bug#1337: Improper use of sscanf in procps
Reply-To: Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, debian-bugs@pixar.com
Resent-From: Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>
Resent-To: debian-devel@pixar.com
Resent-Date: Thu, 19 Oct 1995 20:48:01 GMT
Resent-Message-ID: <debian-bugs-handler.1337.B10192037430@pixar.com>
Resent-Sender: iwj10@cus.cam.ac.uk
X-Debian-PR-Package: procps
X-Debian-PR-Keywords: 
Received: via spool for debian-bugs; Thu, 19 Oct 1995 20:48:01 GMT
Received: with rfc822 via encapsulated-mail; Thu, 19 Oct 1995 20:37:41 GMT
Received: from pixar.com by mongo.pixar.com with smtp
	(Smail3.1.28.1 #15) id m0t61hK-0004AEC; Thu, 19 Oct 95 13:36 PDT
Received: from i17linuxb.ists.pwr.wroc.pl by pixar.com with SMTP id AA18584
  (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Thu, 19 Oct 1995 13:35:49 -0700
Received: (from marekm@localhost) by i17linuxb.ists.pwr.wroc.pl (8.6.12/8.6.9) id VAA19249; Thu, 19 Oct 1995 21:36:03 +0100
From: Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>
Message-Id: <199510192036.VAA19249@i17linuxb.ists.pwr.wroc.pl>
To: debian-bugs@pixar.com, cblake@ucsd.edu
Date: Thu, 19 Oct 1995 21:36:02 +0100 (MET)
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 1290

The patch which replaces the %40c format with %39s sometimes doesn't
do the right thing: if the command name contains whitespace, it will
be truncated (according to the scanf man page, the %s format "matches
a sequence of non-white-space characters").  I suggest to apply the
patch below.

BTW, this bug also sometimes causes strange output for zombie processes:
the pid and uid fields containing garbage.  After converting the strange
pid value to hex and each byte to ASCII, this is "ie>\0".  This is caused
by strcat() adding " <zombie>" to the string which is too long (not NUL-
terminated) and overwriting other fields in the structure.  Not good...

Marek

diff -urN procps-0.97.orig/snap.c procps-0.97/snap.c
--- procps-0.97.orig/snap.c	Sun Sep 25 19:46:21 1994
+++ procps-0.97/snap.c	Thu Oct 19 21:33:56 1995
@@ -35,7 +35,8 @@
 	    ;
     *tmp='\0';
     /* Now we can parse these two strings separately */
-    sscanf(S, "%d %40c", &P->pid, P->cmd);
+    memset(P->cmd, 0, sizeof(P->cmd);
+    sscanf(S, "%d %39c", &P->pid, P->cmd);  /* sizeof(P->cmd) == 40 */
     sscanf(tmp+1, "%c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u "
                   "%d %u %u %u %u %u %u %u %u %d %d %d %d %u",
            &P->state, &P->ppid, &P->pgrp, &P->session, &P->tty, &P->tpgid,


Message sent:


From: iwj10@thor.cam.ac.uk (Ian Jackson)
To: Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>
Subject: Bug#1337: Info received (was Bug#1337: Improper use of sscanf in procps)
In-Reply-To: <199510192036.VAA19249@i17linuxb.ists.pwr.wroc.pl>
References: <199510192036.VAA19249@i17linuxb.ists.pwr.wroc.pl>

Thank you for the additional information you have supplied regarding
this problem report.  It has been forwarded to the developers to
accompany the original report.

If you wish to continue to submit further information on your problem,
please do the same thing again: send it to debian-bugs@pixar.com, ensuring
that the Subject line starts with "Bug#1337" or "Re: Bug#1337" so that
we can identify it as relating to the same problem.

Please do not reply to the address at the top of this message,
unless you wish to report a problem with the bug-tracking system.

Ian Jackson
(maintainer, debian-bugs)


Ian Jackson / iwj10@thor.cam.ac.uk, with the debian-bugs tracking mechanism
This page last modified 07:43:01 GMT Wed 01 Nov