mirror of
https://github.com/nganhkhoa/CTF-All-In-One.git
synced 2025-06-24 04:05:03 +07:00
update integer overflow
This commit is contained in:
20
src/Others/3.3.2_integer.c
Normal file
20
src/Others/3.3.2_integer.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
void validate_passwd(char *passwd) {
|
||||
char passwd_buf[11];
|
||||
unsigned char passwd_len = strlen(passwd);
|
||||
if(passwd_len >= 4 && passwd_len <= 8) {
|
||||
printf("good!\n");
|
||||
strcpy(passwd_buf, passwd);
|
||||
} else {
|
||||
printf("bad!\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc != 2) {
|
||||
printf("error\n");
|
||||
return 0;
|
||||
}
|
||||
validate_passwd(argv[1]);
|
||||
}
|
Reference in New Issue
Block a user