Skip to content

Combining control and Data in Machine-Level programs

Understanding pointers

  • Pointers can also point to functions

GDB Debugger

Figure 3.39

Buffer overflow

  • Consider this example program:
char *mygets(char *s){
int c;
char *dest = s;
while ((c = getchar()) != '\n' && c != EOF)
*dest++ = c;
if (c == EOF && dest == s){
return NULL;
}
*dest++ = '\0';
return s;
}
void echo(){
char buf[8];
mygets(buf);
puts(buf);
}

Jump Instructions