Advertisement
Advertisement
| 04.09.2008 at 11:03AM PDT, ID: 23309107 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: |
C:
int getbuf()
{
char buf[12];
/* Read line of text and store in buf */
Gets(buf);
return 1;
}
Assembly:
08048f40 <getbuf>:
8048f40: 55 push %ebp
8048f41: 89 e5 mov %esp,%ebp
8048f43: 83 ec 18 sub $0x18,%esp
8048f46: 8d 45 f4 lea -0xc(%ebp),%eax
8048f49: 89 04 24 mov %eax,(%esp)
8048f4c: e8 7f fe ff ff call 8048dd0 <Gets>
8048f51: b8 01 00 00 00 mov $0x1,%eax
8048f56: c9 leave
8048f57: c3 ret
8048f58: 90 nop
8048f59: 8d b4 26 00 00 00 00 lea 0x0(%esi),%esi
GDB:
(gdb) break getbuf // Set up breakpoint to getbuf function after I type in my input
Breakpoint 1, 0x08048f46 in getbuf ()
(gdb) run < input.txt // Run the program with my input in a file input.txt
Starting program: bufbomb
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(gdb) info frame // See what stack looks like?
Stack level 0, frame at 0xbf8e3470:
eip = 0x8048f46 in getbuf; saved eip 0x8048f7e
called by frame at 0xbf8e3490
Arglist at 0xbf8e3468, args:
Locals at 0xbf8e3468, Previous frame's sp is 0xbf8e3470
Saved registers:
ebp at 0xbf8e3468, eip at 0xbf8e346c
(gdb) info registers // See what registers look like right now.
eax 0x3 3
ecx 0x0 0
edx 0x6d30b0 7155888
ebx 0x0 0
esp 0xbf8e3450 0xbf8e3450
ebp 0xbf8e3468 0xbf8e3468
esi 0x3 3
edi 0x8744018 141836312
eip 0x8048f46 0x8048f46 <getbuf+6>
eflags 0x286 [ PF SF IF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
(gdb) stepi // Move one more instruction.
0x08048f49 in getbuf ()
(gdb) info frame // See current stack information.
Stack level 0, frame at 0xbf8e3470:
eip = 0x8048f49 in getbuf; saved eip 0x8048f7e
called by frame at 0xbf8e3490
Arglist at 0xbf8e3468, args:
Locals at 0xbf8e3468, Previous frame's sp is 0xbf8e3470
Saved registers:
ebp at 0xbf8e3468, eip at 0xbf8e346c
(gdb) info registers // See register information. Notice eax should now have address of buf array.
eax 0xbf8e345c -1081199524
ecx 0x0 0
edx 0x6d30b0 7155888
ebx 0x0 0
esp 0xbf8e3450 0xbf8e3450
ebp 0xbf8e3468 0xbf8e3468
esi 0x3 3
edi 0x8744018 141836312
eip 0x8048f49 0x8048f49 <getbuf+9>
eflags 0x386 [ PF SF TF IF ]
cs 0x73 115
ss 0x7b 123
ds 0x7b 123
es 0x7b 123
fs 0x0 0
gs 0x33 51
|