From owner-freebsd-hackers Wed Feb 19 23:51:38 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id XAA27008 for hackers-outgoing; Wed, 19 Feb 1997 23:51:38 -0800 (PST) Received: from hydrogen.nike.efn.org (metriclient-12.uoregon.edu [128.223.172.12]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA26969; Wed, 19 Feb 1997 23:50:35 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by hydrogen.nike.efn.org (8.8.4/8.8.4) with SMTP id XAA12535; Wed, 19 Feb 1997 23:50:14 -0800 (PST) Date: Wed, 19 Feb 1997 23:50:14 -0800 (PST) From: John-Mark Gurney Reply-To: John-Mark Gurney To: Guido van Rooij cc: audit-bin@FreeBSD.ORG, FreeBSD-hackers@FreeBSD.ORG Subject: Re: hmm In-Reply-To: <199702200739.IAA04720@gvr.win.tue.nl> Message-ID: X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Thu, 20 Feb 1997, Guido van Rooij wrote: > > > It seems a bit strange to me. Just like the first part of the line > > > underneath btw: > > > if (*p != '\0' && p[strlen(p) - 1] == '[') { > > > ^^^^^^^^^^ > > > > that makes sure that the strlen(p) > 0... you wouldn't want to access > > p[-1] would you?? > > > > hope this helps... ttyl.. > > > > But p points to argv[0]. According to me that is always non-empty. but as someone pointed out... with a direct exec it can be otherwise... I just wrote a couple programs that proved this... here's the output: number args: 3 argv[0} len(0): argv[1} len(6): parama argv[2} len(6): paramb basicly the program I ran did: char *strings[] = { "", "parama", "paramb", 0}; execv("dump", strings); and dump was a program that did basicly: for(i=0;i