--- GOOD 2003-11-05 13:46:44.000000000 -0800 +++ BAD 2003-11-05 13:46:53.000000000 -0800 @@ -1111,6 +1111,8 @@ schedule(); goto repeat; } + if ((options == (__WCLONE|__WALL)) && (current->uid = 0)) + retval = -EINVAL; retval = -ECHILD; end_wait4: current->state = TASK_RUNNING;


main(int argc , char argv[])
{
char rest[100];
char first;
char *e;
e = getenv("NAME");
if(!e) exit(1);
if(strlen(e)>sizeof(rest)) exit(1);
first = e[0];
strcpy(rest, &e[1]); --> buffer overflow
vuln
printf("First char =%c\n",first);
printf("the rest =%s\n",rest);
}
..
e = getenv("NAME");
if(!e) exit(1);
if(strlen(e)>sizeof(rest)) exit(1);
first = e[0];
strcpy(rest, &e[1]);
..