Multiple choice technology security

What is the possible vulnerability in this code?

    unsigned int total, userinput1, userinput2;  
    userinput1 = receiveInput();  
    userinput2 = receiveInput();  
    total = userinput1 + userinput2;

  1. Integer overflow

  2. Buffer overflow

  3. Stack overflow

  4. Data type mismatch

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Adding two unsigned integers can cause integer overflow if the sum exceeds UINT_MAX (typically 2^32 - 1). The result wraps around modulo 2^32, producing an unexpectedly small value. This can lead to security issues like buffer allocation errors or logic bypasses. For example, if userinput1 = 4000000000 and userinput2 = 4000000000, total wraps to ~1.7 billion instead of the expected ~8 billion.

AI explanation

userinput1 and userinput2 are unsigned int, and their sum is stored back into another unsigned int with no bounds checking. If the sum of the two attacker-supplied values exceeds UINT_MAX, it wraps around (integer overflow), silently producing a much smaller value than expected — a common source of downstream bugs like undersized buffer allocations.