PastorTaz
July 19th, 2007, 02:43 AM
I'm working on a practical exam on smashing a stack. I'm running Feisty on a Dell 820. I have Feisty in both VMWare and native boot.
The code I'm using is C++. Here is the code used...
void function (char *str)
{
char buffer [100];
strcpy(buffer, str); //The strcpy function does not check for bounds
}
int main ()
{
char string[512];
int i;
for (i=0; i<512; i++) //loop 512 times
{
string[i] = 'A';
}
function(string);
exit(0);
}
When I use gcc I get this error
root@vm-ubuntu:/lpt/ceptlab# gcc -o overflow3 overflow.c
overflow.c: In function ‘function’:
overflow.c:5: warning: incompatible implicit declaration of built-in function ‘strcpy’
overflow.c: In function ‘main’:
overflow.c:18: warning: incompatible implicit declaration of built-in function ‘exit’
root@vm-ubuntu:/lpt/ceptlab#
When I use gcc-3.3 it compiles just fine.
Can anyone tell me why?
Thanks,
The code I'm using is C++. Here is the code used...
void function (char *str)
{
char buffer [100];
strcpy(buffer, str); //The strcpy function does not check for bounds
}
int main ()
{
char string[512];
int i;
for (i=0; i<512; i++) //loop 512 times
{
string[i] = 'A';
}
function(string);
exit(0);
}
When I use gcc I get this error
root@vm-ubuntu:/lpt/ceptlab# gcc -o overflow3 overflow.c
overflow.c: In function ‘function’:
overflow.c:5: warning: incompatible implicit declaration of built-in function ‘strcpy’
overflow.c: In function ‘main’:
overflow.c:18: warning: incompatible implicit declaration of built-in function ‘exit’
root@vm-ubuntu:/lpt/ceptlab#
When I use gcc-3.3 it compiles just fine.
Can anyone tell me why?
Thanks,