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: <jlongs2_at_uic.edu>
Date: Thu, 25 May 2006 15:28:00 -0500 (CDT)

On Tue, 23 May 2006, padre_at_correo.ugr.es wrote:

> int main (int argc, char **argv)
> {
> char *a;
> char *b;
>
> a=malloc(char *)(100);
> b=malloc(char *)(100);
>
> if (argc)
> exit (-1);
> else {
> strcpy(a,argv[1]);
> }
>
> free (a);
>
> return 0;
> }

You're going to have to execve(2) that program from another program, in
order to control its argv/argc.

printargc.c:
int main(int argc, char **argv)
{
     printf("%d\n",argc);
}

execargc.c:
int main()
{
     char *av = 0;
     execve("./printargc",&av,0);
}

$ ./printargc
1
$ ./execargc
0

This doesn't leave you much of anywhere though, because you can't fill
that buffer...
Received on May 29 2006

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos