Reputation: 512
I am trying to follow a video tutoial on buffer overflow from this link and below is the code which I am trying.
#include <stdio.h>
GetInput()
{
char buffer[8];
gets(buffer);
puts(buffer);
}
main()
{
GetInput();
return 0;
}
I am getting an isssue in gdb debugging, while I step onto i.e at line 7, I get the below error:
_IO_gets (buf=0xbffff458 "k\204\004\b") at iogets.c:33
33 iogets.c: No such file or directory.
I am following exactly the same steps as mentioned in the tutorial. I am using 32 bit Kali linux on virtual box
Can anyone help me to get through this problem.
Upvotes: 6
Views: 1492
Reputation: 106
The author of the post is following a buffer overflow exploitation course. Instead of helping him, everyone jumped with off topic information. We all know that the code is wrong, but then, how you are supposed to learn buffer overflow exploitation if not on a bad code ?
In this case debugging didn't work properly because location of the debug file is somewhere else.
(gdb) show debug-file-directory
The directory where separate debug symbols are searched for is "/usr/lib/debug"
Execute the following in gdb
(gdb) set debug-file-directory
Now you will be able to debug your code. HF
Upvotes: 9
Reputation: 53006
The reason is simply that, glibc source code is missing. It doesn't matter anyway because the bug is not likely in glibc, in this case your code is using the dangerous, deprecated gets()
and hence it can easily overflow the buffer
array, causing Undefined Behavior.
Upvotes: 1