On Fri, Jul 13, 2012 at 08:53:25AM +0300, Pierre Gaston wrote:
> On Thu, Jul 12, 2012 at 8:09 PM, Ernesto Messina
> <ernesto.mess...@gmail.com> wrote:
> > Hello, I think I found an overflow bug. I got the follow C program:
> >
> > #include <stdio.h>
> > #include <string.h>
> >
> > int main(int argc, char *argv[])
> > {
> >     char a[10];
> >     int i;
> >
> >     strcpy(a, argv[1]);
> >
> >   return 0;
> > }
> >
> > Compiling with: gcc program.c -o program
> > And running: program `perl -e 'print "a" x 24'`
> >
> > The terminal loses the control, entering into a infinite buckle, and
> 
> bash is not the terminal and is not involved once the program runs,
> and yes, writing buggy programs can cause buggy behaviour. On this
> system man strcpy says under BUGS:

It's not even related to the terminal, either.  The C program does not
perform any input or output at all (despite the <stdio.h> include).
Your platform goes into an infinite loop when you run this program,
so the terminal just sits there waiting for output that never arrives.
Bash just sits there waiting for its child process (your C program) to
terminate, which it never does (until you hit Ctrl-C or whatever your
terminal has mapped to Interrupt).

So, it's not a bug in either bash or the terminal.  It's a bug in your
C program.

Reply via email to