We are given a condition n1 > n1 + n2 OR n2 > n1 + n2
which asks us to input two positive integers such that the resulting number will be a negative one. We are also given a source file with C code in it. After carefully reading the code, we can see that the first function addInt0vf()
checks for the addition of the two input numbers and integer overflow.
The main()
function's code clearly states that if the value of addInt0vf
function is 0
, it will not give the flag, and if the value is -1
, it will return the flag only if the two input numbers are positive. I quickly googled the limits of the int data type in C and found 2147483647
to be the upper limit. I used this as first input and 1 as the second.
... and we have overflow, outputting our flag!
Top comments (0)