Hacking - The Art of Exploitation, 2nd Edition
Programming 67 static.c include <stdio.h> void function() { // An example function, with its own context int var = 5; stat ...
68 0x200 Notice that the static_var retains its value between subsequent calls to function(). This is because static variables r ...
Programming 69 With the addresses of the variables displayed, it is apparent that the static_var in main() is different than the ...
70 0x200 The heap segment is a segment of memory a programmer can directly control. Blocks of memory in this segment can be allo ...
Programming 71 The following stack_example.c code has two functions: main() and test_function(). stack_example.c void test_funct ...
72 0x200 End of assembler dump (gdb) disass test_function() Dump of assembler code for function test_function: 0x08048344 <te ...
Programming 73 pointer (SFP) and is later used to restore EBP back to its original state. The current value of ESP is then copie ...
74 0x200 0x804836f <main+24>: mov DWORD PTR [esp+8],0x3 0x8048377 <main+32>: mov DWORD PTR [esp+4],0x2 0x804837f < ...
Programming 75 After the execution finishes, the entire stack frame is popped off of the stack, and the EIP is set to the return ...
76 0x200 int global_initialized_var = 5; void function() { // This is just a demo function. int stack_var; // Notice this variab ...
Programming 77 stack_var is at address 0xbffff834 the function's stack_var is at address 0xbffff814 reader@hacking:~/booksrc $ T ...
78 0x200 int main(int argc, char argv[]) { char char_ptr; // A char pointer int *int_ptr; // An integer pointer int mem_size; if ...
Programming 79 This program accepts a command-line argument for the size of the first memory allocation, with a default value of ...
80 0x200 function chooses to reclaim freed space for new allocations. Often, simple informative printf() statements and a little ...
Programming 81 printf("char_ptr (%p) --> '%s'\n", char_ptr, char_ptr); printf("\t[-] freeing int_ptr's heap memory...\n"); fr ...
82 0x200 The bar code on the back of this book represents a number. Because this number is unique among the other books in a boo ...
Programming 83 strcpy(buffer, argv[1]); // Copy into buffer. printf("[DEBUG] buffer @ %p: \'%s\'\n", buffer, buffer); printf("[D ...
84 0x200 reader@hacking:~/booksrc $ ./simplenote "this is a test note" [DEBUG] buffer @ 0x804a008: 'this is a test note' [DEBUG] ...
Programming 85 for(i=0; i < 4; i++) { bit_a = (i & 2) / 2; // Get the second bit. bit_b = (i & 1); // Get the first b ...
86 0x200 printf("\n"); display_flags("O_WRONLY|O_APPEND|O_CREAT", O_WRONLY|O_APPEND|O_CREAT); } void display_flags(char *label, ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf