Consequences of this buffer overflow?

后端 未结 11 2055
悲&欢浪女
悲&欢浪女 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:52

    Yes, you are correct. The buffer allocated will be 2 bytes too small to hold the string.

    Since this is being allocated on the heap, it would be possible for this to result in a heap corruption. However, the liklihood of that depends on the what other allocations and releases of memory have occurred prior to this point and also on heap manager being used. See Heap Overflow for more.

提交回复
热议问题