当前位置: 技术问答>linux和unix
求教:gdp调试的时候查看寄存器信息提示 The program has no registers now.怎么解决?
来源: 互联网 发布时间:2017-05-03
本文导语: 源代码是这样的 #include "stdio.h" #include "string.h" char code[]= "x41x41x41x41x41" "x41x41x41x41x41" "x41x41x41x41x41" "x41x41x41" "x41x41x41x41" "x82x84x04x08" "x00"; void copy(const char *input) { char buf[10]; strcpy(buf, input); printf("%s n", buf); } void b...
源代码是这样的
#include "stdio.h"
#include "string.h"
char code[]=
"x41x41x41x41x41"
"x41x41x41x41x41"
"x41x41x41x41x41"
"x41x41x41"
"x41x41x41x41"
"x82x84x04x08"
"x00";
void copy(const char *input)
{
char buf[10];
strcpy(buf, input);
printf("%s n", buf);
}
void bug(void)
{
printf("I shouldn't have appearedn");
}
int main(int argc, char *argv[])
{
copy(code);
return 0;
}
使用gdb调试进行溢出攻击的时候,
(gdb) disasse main
Dump of assembler code for function main:
0x0000000000400603 : push %rbp
0x0000000000400604 : mov %rsp,%rbp
0x0000000000400607 : sub $0x10,%rsp
0x000000000040060b : mov %edi,-0x4(%rbp)
0x000000000040060e : mov %rsi,-0x10(%rbp)
0x0000000000400612 : mov $0x601050,%edi
0x0000000000400617 : callq 0x4005bc
0x000000000040061c : mov $0x0,%eax
0x0000000000400621 : leaveq
0x0000000000400622 : retq
End of assembler dump.
(gdb) info all-registers
The program has no registers now.
求教~THX
#include "stdio.h"
#include "string.h"
char code[]=
"x41x41x41x41x41"
"x41x41x41x41x41"
"x41x41x41x41x41"
"x41x41x41"
"x41x41x41x41"
"x82x84x04x08"
"x00";
void copy(const char *input)
{
char buf[10];
strcpy(buf, input);
printf("%s n", buf);
}
void bug(void)
{
printf("I shouldn't have appearedn");
}
int main(int argc, char *argv[])
{
copy(code);
return 0;
}
使用gdb调试进行溢出攻击的时候,
(gdb) disasse main
Dump of assembler code for function main:
0x0000000000400603 : push %rbp
0x0000000000400604 : mov %rsp,%rbp
0x0000000000400607 : sub $0x10,%rsp
0x000000000040060b : mov %edi,-0x4(%rbp)
0x000000000040060e : mov %rsi,-0x10(%rbp)
0x0000000000400612 : mov $0x601050,%edi
0x0000000000400617 : callq 0x4005bc
0x000000000040061c : mov $0x0,%eax
0x0000000000400621 : leaveq
0x0000000000400622 : retq
End of assembler dump.
(gdb) info all-registers
The program has no registers now.
求教~THX
|
程序还没有. .当然就没有寄存器啦啦啦啦.你run一下寄存器就出来了
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。