Insecure-programming-stack2 Insecure Programming by example Stack 2 # include <stdio.h> int main ( ) { int cookie ; char buf [ 80 ] ; printf ( "buf: %08x cookie: %08x\n" , & buf , & cookie ) ; gets ( buf ) ; if ( cookie == 0x01020305 ) printf ( "you win!\n" ) ; } 이번 문제의 경우 목표 cookie 값이 0x01020305로 ASCII 코드로 확인해보면 문자로 입력이 불가한 값임을 알 수 있다. ASCII Table Tables For convenience, below are more compact tables in hex and decimal. 2 3 4 5 6 7 30 40 50 60 70 80 90 100 110 120 ------------- --------------------------------- 0: 0 @ P ` p 0: ( 2 < F P Z d n x 1: ! 1 A Q a q 1: ) 3 = G Q [ e o y 2: " 2 B R b r 2: * 4 > H R \ f p z 3: # 3 C S c s 3: ! + 5 ? I S ] g q { 4: $ 4 D T d t 4: " , 6 @ J T ^ h r | 5: % 5 E U e u 5: #