blackjack

Question

Hey! check out this C implementation of blackjack game!
I found it online
* http://cboard.cprogramming.com/c-programming/114023-simple-blackjack-program.html

I like to give my flags to millionares.
how much money you got?

Running at : nc pwnable.kr 9009

Writeup

  • betting() source code

    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
    
    • if (bet > cash)當bet大於cash時,會要求重新輸入,但接著就return bet了,導致第二次重新輸入的值沒被檢查到,這時只要第二次輸入百萬的值,然後贏過電腦就得到百萬元了。
YaY_I_AM_A_MILLIONARE_LOL

Cash: $1410065907

results matching ""

    No results matching ""