Re: argc issue
| Newsgroups | gmane.comp.security.vulnerabilities |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 23 May 2006 19:51:58 +0200, [email protected] 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.
signature.asc
(application/pgp-signature, 226 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Exmh version 2.5 07/13/2001 iD8DBQFEdd/AcC3lWbTT17ARAlOGAJ4j636TpRcOlfOhvNwH9gmInfgObwCfe1AC w6gD/SJ3FrYCLVtQ/HQI69g= =I7il -----END PGP SIGNATURE-----