Top "Buffer-overflow" questions

Usually occurs when you attempt to copy data into a buffer without checking for sufficient space, causing data to be overwritten in neighboring cells.

Why should you use strncpy instead of strcpy?

Edit: I've added the source for the example. I came across this example: char source[MAX] = "123456789"; char source1[MAX] = "123456789"; char …

c buffer-overflow strcpy c89 strncpy
Why is the gets function so dangerous that it should not be used?

When I try to compile C code that uses the gets() function with GCC, I get this warning: (.text+0x34): …

c fgets buffer-overflow gets
How to turn off gcc compiler optimization to enable buffer overflow

I'm working on a homework problem that requires disabling compiler optimization protection for it to work. I'm using gcc 4.4.1 on …

c gcc buffer-overflow compiler-optimization
How to prevent scanf causing a buffer overflow in C?

I use this code: while ( scanf("%s", buf) == 1 ){ What would be the best way to prevent possible buffer overflow so …

c scanf buffer-overflow
Does Java have buffer overflows?

Does Java have buffer overflows? If yes can you give me scenarios?

java buffer-overflow buffer-overrun
How to determine the size of an allocated C buffer?

I have a buffer and want to do a test to see if the buffer has sufficient capacity I.e. …

c malloc buffer buffer-overflow
Malloc segmentation fault

Here is the piece of code in which segmentation fault occurs (the perror is not being called): job = malloc(sizeof(…

c segmentation-fault malloc stack-overflow buffer-overflow
addressSanitizer: heap-buffer-overflow on address

I am at the very beginning of learning C. I am trying to write a function to open a file, …

c memory-leaks heap buffer-overflow
return to lib_c buffer overflow exercise issue

I'm supposed to come up with a program that exploits the "return to libc buffer overflow". This is, when executed, …

c bash buffer-overflow
How does a NOP sled work?

I can't find a good source that answers this question. I know that a nop sled is a technique used …

c assembly stack buffer-overflow nop