Getting access into format string vulnerability program

Viewed 38
#include <stdio.h>
char passwd[100];
char getPasswd()
{
 int trigger = 'F';
 int *t = &trigger;
 fgets(passwd, sizeof(passwd), stdin);
 printf("Password is ");
 printf(passwd);
 return (char)(*t);
}
void main()
{
 printf("Please enter password: ");
 if (getPasswd() == 'T')
 {
 printf("You are logged in!\n");
exit(0);
 }
 else
 {
 printf("The password is incorrect.\n");
exit(1);
 }
}

Hi I'm trying to gain access to "you're logged in" by exploiting the format vulnerability but I'm kind of stuck at figuring out the password I could use to exploit this, appreciate the help

0 Answers
Related