Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Matt Wilson <msw@redhat.com>
To: axp-list@redhat.com
Subject: Re: Uh...this looks bad.
Date: Sun, 21 Jan 2001 21:14:28 -0500	[thread overview]
Message-ID: <20010121211428.A22229@devserv.devel.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0101211824220.10134-100000@res104a-017.rh.rit.edu>; from superluser@mail.isc.rit.edu on Sun, Jan 21, 2001 at 06:51:40PM -0500

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




  parent reply	other threads:[~2001-01-22  2:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Matt Wilson [this message]
2001-01-24  2:17 ` Uh...this looks bad Paul Jakma
read-only archive

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