简体   繁体   English

GDB在进入断点时抛出错误

[英]GDB throws error while stepping into at breakpoint

I am trying to follow a video tutoial on buffer overflow from this link and below is the code which I am trying. 我试图通过此链接跟踪视频tutoial缓冲区溢出,下面是我正在尝试的代码。

#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 ie at line 7, I get the below error: 我在gdb调试中获得了一个问题,而我在第7行进入ie,我收到以下错误:

_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 我在虚拟盒子上使用32位Kali linux

Can anyone help me to get through this problem. 任何人都可以帮助我解决这个问题。

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中执行以下命令

(gdb) set debug-file-directory

Now you will be able to debug your code. 现在您将能够调试代码。 HF HF

The reason is simply that, glibc source code is missing. 原因很简单,缺少glibc源代码。 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 . 无论如何都没关系因为glibc中不存在bug,在这种情况下你的代码使用危险的,不推荐使用的gets() ,因此它很容易溢出buffer数组,从而导致Undefined Behavior

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM