Security Basics mailing list archives

question about malloc()


From: Seung Hyun Cho <s970501 () gmail com>
Date: Wed, 14 Sep 2005 21:14:20 +0900

Hi,

I am studying on exploitation. 
But my knowldge of c programming is very limited.
I studied c language 10 yrs ago and never used it.
Now i am having some problems.

I have a question about exploit example of my book.

----------------------------------
...
char *buf;
buf = malloc(1<<30);
fgets(buf, 1024, stdin);
printf("%s\n", buf);
...
----------------------------------

Can anyone explain this? This should be very simple...
when I put buf = malloc(1<<29), it is working...

What is going on here...?

help~


Current thread: