so , I will to Understand debugging , i am very new and I am not a IT student.. .I am since Three Days this exercise to Understand , but without sucess...
I working with Linux and the Program GDB:
1 #include <string.h>
2 #include <stdio.h>
3
4 void overflowed() {
5 printf("%s\n", "Execution Hijacked");
6 }
7
8 void function1(char *str){
9 char buffer[5];
10 strcpy(buffer, str); (**3**)
11 } (**2**)
12 void main(int argc, char *argv[])
13 {
14 function1(argv[1]); (**1**)
15 printf("%s\n", "Executed normally");
16 }
The Number 1 , 2 , 3 are the Program Break Punkt .
(gdb) break 14
Breakpoint 1 at 0x8048433: file overflowtest.c, line 14.
(gdb) break 10
Breakpoint 2 at 0x804840e: file overflowtest.c, line 10.
(gdb) break 11
Breakpoint 3 at 0x8048420: file overflowtest.c, line 11.
Break the line 14,10 and 11 .
than with run to given Four A
(gdb) run AAAA
Starting program: /home/georgia/overflowtest AAAA
Breakpoint 1, main (argc=2, argv=0xbfb73004) at overflowtest.c:14
14 function(argv[1]);
than with x/16xw $esp to my First Break ,line 14 , i come
(gdb) x/16xw $esp
0xbfb72f50: 0xb77e6ff4 0x08049ff4 0xbfb72f78 0x08048489
0xbfb72f60: 0xb780a7b0 0xbfb72f80 0xbfb72fd8 0xb769e775
0xbfb72f70: 0x08048470 0x08048340 0xbfb72fd8 0xb769e775
0xbfb72f80: 0x00000002 0xbfb73004 0xbfb73010 0xb77fab40
so, i to search to Understand , what on the far left is 0xbfb72f50: and all Hex back from it come, his meaning.... . Can Please anybody help me with easy Words explain , to describe it ? , Very Thanks!
The first column is the address, that is, on the first line, the value of the %esp
register.
For an explanation of the stack pointer (%esp
) and stack frame (%ebp
) registers, consult a text on compiler construction, such as chapter 6, Activation Records, in Appel's Modern compiler implementation in ML. Relevant keywords are activation records and stack frames. Wikipedia has some basic information, too.
So , How i Understande the Memory Adress on the far left :
0xbfb72f50:
0xbfb72f60:
0xbfb72f70:
0xbfb72f80:
are the stack framen where start my Three breakpoints ,but i don't know what the Fisrt Adress to do.... , sorry about this questions , but i am not a Student from IT ....i learn self to Home....
So , answer me self:
Far left are the Memory Adress and what First back to come are the Content-addressable memory , 0xb77e6ff4 is the ESP of the main ’s stack frame . ESP marks the lowest memory address of a Stack , EBP is the highest address , Here 0xbfb72f78 .
User contributions licensed under CC BY-SA 3.0