delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/13/18:26:44

Sender: nate AT cartsys DOT com
Message-ID: <37642DF4.66F6FC8E@cartsys.com>
Date: Sun, 13 Jun 1999 15:17:24 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Exec does not free all memory
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990613114153 DOT 17906c-100000 AT is>
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Sat, 12 Jun 1999, Grzegorz Jablonski wrote:
>
> > The problem occured, when I tried to
> > upgrade the program version from within the program itself.
> 
> I don't see how this could cause any practical problems: the
> conventional memory usage by each subsidiary program is about 18KB, so
> you need much more than a single `exec' to eat up all the conventional
> memory, unless you have 20KB to begin with.

<chuckle> It breaks this interesting little Obfuscated C Contest winner
(Applin from 1995, line breaks changed):

main(v,c)char**c;{for(v[c++]="Hello, world!\n)";
(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)
write(!!*c,*c,!!**c);}

Yes, it execs itself for each letter of the message.

(Note: If you try it on Unix you should use -fwritable-strings to
compile.)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019