Re: Avoiding Buffer Overflows

From: David Correa (tech@linux-tech.com)
Date: 01/09/02


Date: Wed, 9 Jan 2002 13:08:07 -0800 (PST)
From: David Correa <tech@linux-tech.com>
To: security-discuss@linuxsecurity.com

On Tue, 8 Jan 2002, Trano wrote:
> #include <stdio.h>
>
> int
> main(int argc, char **argv)
> {
> char buf[100];
> strcpy(buf, argv[1]);
> exit(1);
> }
Hi,

That code produces a "Segmentation fault (core dumped)"
with gcc version 2.96.

Also this one:

On Wed, 9 Jan 2002, Kenny Colliander wrote:
>#include <stdio.h>
>int main(int argc, char **argv)
>{
> char buf[100+1]; // + NULL
> strncpy(argv[1], buf, 100);
> exit(1);
>}

Regards,

David Correa RHCE CCNA
http://www.linux-tech.com

------------------------------------------------------------------------
     To unsubscribe email security-discuss-request@linuxsecurity.com
         with "unsubscribe" in the subject of the message.