CWE-120 Classic Overflow

Given an input buffer, data is copied without checking its size.

  • If destination buffer is larger than input data, nothing bad happens.

  • If destination buffer is smaller than input data, memory is overwritten.

Impact

Memory is overwritten.

  • Mostly affects local variables.

  • May change the execution flow.

    • Change of local control variables.

    • Change of stored Instruction Pointer.

  • May be used to inject external code.

Solution

Take in consideration the size of the destination buffer!

Last updated