PxL
11.03.2005, 11:54
Ok I have a question it`s a kind of a quest:
Can ypu overflow the buffer and call the function DontCallMe() in this sample code?
#include <stdio.h>
typedef char sbuf[10];
void getstring(sbuf is)
{
gets(is);
puts("You entered: ");
puts(is);
}
void DontCallMe()
{
puts ("Nice!");
}
void main ()
{
sbuf is = "Hi!";
puts("Enter something:");
getstring(is);
}
Can ypu overflow the buffer and call the function DontCallMe() in this sample code?
#include <stdio.h>
typedef char sbuf[10];
void getstring(sbuf is)
{
gets(is);
puts("You entered: ");
puts(is);
}
void DontCallMe()
{
puts ("Nice!");
}
void main ()
{
sbuf is = "Hi!";
puts("Enter something:");
getstring(is);
}