Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Uh...this looks bad.
@ 2001-01-21 23:51 Andrew A. Gill
  2001-01-22  1:01 ` John Jasen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrew A. Gill @ 2001-01-21 23:51 UTC (permalink / raw)
  To: AXP-list

Now, I'm new to incorporating command-line arguments into my programs,
but this looks bad.  With the updated GCC (gcc-2.96-69), when I try the
following simple program:

/* --- */
#include <stdio.h>

void main(int argc, char *argv[])
{
  int i;
  for(i = 1; i < 20 ; i++)
     printf("%s\n",argv[i]);
}
/* --- */

I get the following output:

--- This has been edited, but it looks like the info is correct. ---
(null)
PWD=
HOSTNAME=
QTDIR=
LESSOPEN=
KDEDIR=
USER=
LS_COLORS=
MACHTYPE=
MAIL=
INPUTRC=
BASH_ENV=
LOGNAME=
SHLVL=
SHELL=
USERNAME=
HOSTTYPE=
OSTYPE=
HISTSIZE=
---

It seems like this might provide too much information to a possibly
malicious user.

So am I just dumb, and are these trivial environmental variables (it
also lists HOME=, TERM=, and PATH= before segfaulting), or is this kind
of bad?

-- 
|Andrew A. Gill                       |I posted to Silent-Tristero and|
|<superluser@mail.rit.edu>            |all I got was this stupid sig! |
|alt.tv.simpsons CBG-FAQ author       |                               |
|                          (Report all obscene mail to Le Maitre Pots)|
|<http://trystero.rh.rit.edu>                         Temporary sig: --

I'm not betting.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Uh...this looks bad.
  2001-01-21 23:51 Uh...this looks bad Andrew A. Gill
@ 2001-01-22  1:01 ` John Jasen
  2001-01-22  4:52   ` multia with the 2.2.16-3 kernel jharris
  2001-01-22  2:14 ` Uh...this looks bad Matt Wilson
  2001-01-24  2:17 ` Paul Jakma
  2 siblings, 1 reply; 7+ messages in thread
From: John Jasen @ 2001-01-22  1:01 UTC (permalink / raw)
  To: AXP-list

On Sun, 21 Jan 2001, Andrew A. Gill wrote:

> Now, I'm new to incorporating command-line arguments into my programs,
> but this looks bad.  With the updated GCC (gcc-2.96-69), when I try the
> following simple program:

Don't panic ... Its just printing out shell environment variables.

--
-- John E. Jasen (jjasen1@umbc.edu)
-- In theory, theory and practise are the same. In practise, they aren't.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Uh...this looks bad.
  2001-01-21 23:51 Uh...this looks bad Andrew A. Gill
  2001-01-22  1:01 ` John Jasen
@ 2001-01-22  2:14 ` Matt Wilson
  2001-01-24  2:17 ` Paul Jakma
  2 siblings, 0 replies; 7+ messages in thread
From: Matt Wilson @ 2001-01-22  2:14 UTC (permalink / raw)
  To: axp-list

Don't forget, your can also write main as:

void main (int argc, char *argv[], char *env[])

You've just gone from argv to the environment variables passed to you.

Matt

On Sun, Jan 21, 2001 at 06:51:40PM -0500, Andrew A. Gill wrote:
> Now, I'm new to incorporating command-line arguments into my programs,
> but this looks bad.  With the updated GCC (gcc-2.96-69), when I try the
> following simple program:
> 
> /* --- */
> #include <stdio.h>
> 
> void main(int argc, char *argv[])
> {
>   int i;
>   for(i = 1; i < 20 ; i++)
>      printf("%s\n",argv[i]);
> }
> /* --- */
> 
> I get the following output:
> 
> --- This has been edited, but it looks like the info is correct. ---
> (null)
> PWD=
> HOSTNAME=
> QTDIR=
> LESSOPEN=
> KDEDIR=
> USER=
> LS_COLORS=
> MACHTYPE=
> MAIL=
> INPUTRC=
> BASH_ENV=
> LOGNAME=
> SHLVL=
> SHELL=
> USERNAME=
> HOSTTYPE=
> OSTYPE=
> HISTSIZE=
> ---
> 
> It seems like this might provide too much information to a possibly
> malicious user.
> 
> So am I just dumb, and are these trivial environmental variables (it
> also lists HOME=, TERM=, and PATH= before segfaulting), or is this kind
> of bad?
> 
> -- 
> |Andrew A. Gill                       |I posted to Silent-Tristero and|
> |<superluser@mail.rit.edu>            |all I got was this stupid sig! |
> |alt.tv.simpsons CBG-FAQ author       |                               |
> |                          (Report all obscene mail to Le Maitre Pots)|
> |<http://trystero.rh.rit.edu>                         Temporary sig: --
> 
> I'm not betting.
> 
> 
> 
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list




^ permalink raw reply	[flat|nested] 7+ messages in thread

* multia with the 2.2.16-3 kernel
  2001-01-22  1:01 ` John Jasen
@ 2001-01-22  4:52   ` jharris
  2001-01-22  5:17     ` Matt Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: jharris @ 2001-01-22  4:52 UTC (permalink / raw)
  To: AXP-list

I have an multia running redhat 6.0 and am very happy with it. I have just
installed a few of the rpm upgrades, including the 2.2.16-3 kernel.  The
kernel boots, but the tulip driver seems broken. I see that the log is
full of "No link beat found". Has any one else noticed a problem with the
tulip driver  from 2.2.16-3 in the redhat rpms?






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multia with the 2.2.16-3 kernel
  2001-01-22  4:52   ` multia with the 2.2.16-3 kernel jharris
@ 2001-01-22  5:17     ` Matt Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Wilson @ 2001-01-22  5:17 UTC (permalink / raw)
  To: axp-list

Try using the de4x5 driver with the onboard nic.

Cheers,

Matt

On Sun, Jan 21, 2001 at 08:52:09PM -0800, jharris wrote:
> 
> I have an multia running redhat 6.0 and am very happy with it. I have just
> installed a few of the rpm upgrades, including the 2.2.16-3 kernel.  The
> kernel boots, but the tulip driver seems broken. I see that the log is
> full of "No link beat found". Has any one else noticed a problem with the
> tulip driver  from 2.2.16-3 in the redhat rpms?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: multia with the 2.2.16-3 kernel
       [not found] <Pine.LNX.4.10.10101212047460.758-100000@softwareag.com>
@ 2001-01-22  9:54 ` Joerg Bruehe
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Bruehe @ 2001-01-22  9:54 UTC (permalink / raw)
  To: axp-list

Hi N.N. !

jharris wrote:
> 
> I have an multia running redhat 6.0 and am very happy with it. I have just
> installed a few of the rpm upgrades, including the 2.2.16-3 kernel.  The
> kernel boots, but the tulip driver seems broken. I see that the log is
> full of "No link beat found". Has any one else noticed a problem with the
> tulip driver  from 2.2.16-3 in the redhat rpms?

See my posting of last Tuesday (Jan 16, 2001) on this list: 
   Digital DC 21040 is "DEC_ELCP_OLD" in Kernel 2.2.16 

Until I used the "OLD" parameter, I had the very same symptom. 
(That was SuSE and "Avanti", but also 2.2.16 kernel and "Tulip".) 

Regards, 
Joerg Bruehe 

-- 
Joerg Bruehe, SQL Datenbanksysteme GmbH, Berlin, Germany
     (speaking only for himself)
mailto: joerg@sql.de




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Uh...this looks bad.
  2001-01-21 23:51 Uh...this looks bad Andrew A. Gill
  2001-01-22  1:01 ` John Jasen
  2001-01-22  2:14 ` Uh...this looks bad Matt Wilson
@ 2001-01-24  2:17 ` Paul Jakma
  2 siblings, 0 replies; 7+ messages in thread
From: Paul Jakma @ 2001-01-24  2:17 UTC (permalink / raw)
  To: AXP-list

On Sun, 21 Jan 2001, Andrew A. Gill wrote:

As i understand it:

> I get the following output:
>
> --- This has been edited, but it looks like the info is correct. ---
> (null)

you ran it with no arguments, right? that's the terminator for
*argv[].

then you don't check that i<argc and you continue on and start
accessing memory beyond *argv[]:

> PWD=
> HOSTNAME=
> QTDIR=
> LESSOPEN=
> KDEDIR=
> USER=
> LS_COLORS=
> MACHTYPE=
> MAIL=
> INPUTRC=
> BASH_ENV=
> LOGNAME=
> SHLVL=
> SHELL=
> USERNAME=
> HOSTTYPE=
> OSTYPE=
> HISTSIZE=

this means your environment variables are stored in the memory
directly after *argv[].

Eventually *argv[i] ends up referencing memory that has not been
allocated to you, and so kernel issues your programme a SIGSEGV when
your printf() tries to deference it.

> It seems like this might provide too much information to a possibly
> malicious user.

your test programme is setuid? :)

regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org
PGP5 key: http://www.clubi.ie/jakma/publickey.txt
-------------------------------------------
Fortune:
Lots of folks confuse bad management with destiny.
		-- Frank Hubbard







^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-01-24  2:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-21 23:51 Uh...this looks bad Andrew A. Gill
2001-01-22  1:01 ` John Jasen
2001-01-22  4:52   ` multia with the 2.2.16-3 kernel jharris
2001-01-22  5:17     ` Matt Wilson
2001-01-22  2:14 ` Uh...this looks bad Matt Wilson
2001-01-24  2:17 ` Paul Jakma
     [not found] <Pine.LNX.4.10.10101212047460.758-100000@softwareag.com>
2001-01-22  9:54 ` multia with the 2.2.16-3 kernel Joerg Bruehe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox