gets의 취약점

2019. 5. 19. 16:22PL/C++

gets는 버퍼 오버플로우를 막지 못한다

char buf[5];

gets(buf); // input "hello world"

printf("%s\n", buf); // print "hello world"

 

if using fgets

fgets(buf) // input "hello world"

printf("%s\n", buf); // print "hell"

 

'PL > C++' 카테고리의 다른 글