FormatString-Example

#FormatStringExample
# include <stdio.h>
# include <string.h>
//Format String Example Allowing user to enter crazy input

int main(int argc, char*argv[]){

printf(argv[1]);//Here Not specifying display format by average programmer
return 0;
}
 

//root@kali:~/Desktop/c# gcc formatString.c -o test
//root@kali:~/Desktop/c# ./formatString "Hi aashish"
//Hi aashish

root@kali:~/Desktop/c# ./test "%p %p %p %p "
 root@kali:~/Desktop/c# ./test "%p %p %p %p %n"
//Segmentation fault

Reactions:

0 comments:

Post a Comment