求:判断缓冲区是否为空的C/C++库函数

来源:百度知道 编辑:UC知道 时间:2024/06/02 19:20:04
请问有没有判断缓冲区是否为空的C/C++库函数?

若有,请赐教~谢谢~

写了如下一个简单的缓冲区溢出程序,overflow.txt文件中存放24个小写字母a,通过overflow中buff的溢出会覆盖overflow函数的返回地址(测试可知,overflow文件中第21-24个字母为函数的返回地址空间)。现在已经知道函数hack的入口地址是0x00401270,请问以怎样的格式将0x00401270输入到overflow.txt中,可使得函数溢出导致的后果是执行hack函数。谢谢!

// BufferOverRun.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "BufferOverRun.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// The one and only application object

CWinApp theApp;

using namespace std;

void overflow(char* buff)
{

CFile file;
CFileException er;