首页 > 代码库 > pwnable.kr blackjack之write up

pwnable.kr blackjack之write up

首先我们按提示找到源代码,看这一段:

int betting() //Asks user amount to bet
{
 printf("\n\nEnter Bet: $");
 scanf("%d", &bet);
 
 if (bet > cash) //If player tries to bet more money than player has
 {
        printf("\nYou cannot bet more money than you have.");
        printf("\nEnter Bet: ");
        scanf("%d", &bet);
        return bet;
 }
 else return bet;
} // End Function

提示我们的赌注不能大于我们拥有的钱,但如果我们输入大于我们拥有的钱,依然返回我们输入的值。当我们输入大于100万就得到flag:

当我输入100万时,加上原来的500我现在得到

技术分享

得到flag

 

pwnable.kr blackjack之write up