Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Vulnerability Development: Re: argc issue

Re: argc issue

From: <Valdis.Kletnieks_at_vt.edu>
Date: Thu, 25 May 2006 12:48:00 -0400

On Tue, 23 May 2006 19:51:58 +0200, padre_at_correo.ugr.es said:

> if (argc)
> exit (-1);
> else {
> strcpy(a,argv[1]);
> }

Buggy code. It's basically saying "If there's arguments to the program,
exit. Otherwise, copy the (implicitly non-existent) first argument to 'a'".

> But the main issue is " if (argc) exit(0);" . How can I change the argc
> variable so it contais the value of 0?.

Fix your code, I think you wanted 'if (!argc) exit (-1);'

That's probably easier than trying to over-ride the system startup code
that creates the argc value and passes it to main() (on Linux/Unix boxes,
usually in a stub called crt0.o or similar). Lots of tricky system-dependent
code in there, it's not for the faint of heart.

  • application/pgp-signature attachment: stored
Received on May 26 2006
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos