I am learning C and decided to play around with the code, but not being able to find out where is the vulnerabity in this code.
I have pasted my code here:
#include <stdio.h>
 
char getPasswd() {
  int trigger = 'K';
  char data[100];
  gets(data);
  return (char) trigger;
}
void login() {
  printf("inside!\n");
  exit(0);
}
void main() {
  printf("enter ");
  if (getdata() == 'G') {
    login();
  } else {
    printf("wrong.\n");
    exit(1);
  }
}
If any more info is required please let me know. What I think is vulnerbility is in gets() line 6 since its not safe to use that. I am new so not sure any help is appreciated.
 
    