Skip to content

Instantly share code, notes, and snippets.

@zeldani
Last active July 8, 2017 18:35
Show Gist options
  • Save zeldani/4c4f9af6d6a105a9eaf218714f307753 to your computer and use it in GitHub Desktop.
Save zeldani/4c4f9af6d6a105a9eaf218714f307753 to your computer and use it in GitHub Desktop.
#include <string.h>
#include <stdio.h>
int login(char *password) {
int auth_flag = 0;
char buffer[16];
strcpy(buffer, password);
if (strcmp(buffer,"zeldani") == 0)
auth_flag = 1;
return auth_flag;
}
int main(int argc, char *argv[]) {
if(login(argv[1])){
printf("\nWelcome! :)\n");
} else {
printf("\nAccess Denied.\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment