[英]Any way to bypass the password check here?
static int checkPassword(char* user_pw) {
char dummy[128];
int accept = 0;
char pw[8];
char len;
char* correct_pw = "xf35+";
memset(pw, 0, sizeof(pw));
memset(dummy, 0, sizeof(dummy));
len = strlen(user_pw);
if (len < 8) {
strcpy(pw, user_pw);
}
if (strcmp(pw, correct_pw) == 0) {
accept = 1;
}
return accept;
}
int main(int argc, char* argv[]) {
// Where argv[3] should be password
// ...
if (strlen(argv[3]) > 128) {
fprintf(stderr, "Password is too long!\n");
return 1;
}
if (checkPassword(argv[3]) == 0) {
fprintf(stderr, "Password is incorrect!\n");
return 1;
}
// ...
}
The passwrod here is hard-coded but is there any way to bypass the password check?这里的密码是硬编码的,但是有什么方法可以绕过密码检查吗? I noticed that "len" is declared as a char but still don't know exactly how to solve this
我注意到“len”被声明为一个字符,但仍然不知道如何解决这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.