Consequences of this buffer overflow?

后端 未结 11 2042
悲&欢浪女
悲&欢浪女 2021-01-01 15:44

So here I believe I have a small buffer overflow problem I found when reviewing someone else\'s code. It immediately struck me as incorrect, and potentially dangerous, but a

11条回答
  •  北海茫月
    2021-01-01 15:59

    Your assessment is correct. [edit] with the addition of the correction mentioned by James Curran.[/edit]

    Likely, your test app didn't show the problem because the allocation is rounded up to the next multiple of 4, 8 or 16 (which are common allocation granularities).

    This means you should be able to demonstrate with a 31 character long string.

    Alternatively, use an "instrumenting" native memory profiler that can place guard bytes closely around such an allocation.

提交回复
热议问题