|
此文章由 netstat 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 netstat 所有!转贴必须注明作者、出处和本声明,并保持内容完整
Memcpy will copy payload bytes of memory regardless of what the pointers bp or pl point to. The bug occurs because memcpy copies all of the source payload (pl) and everything after it in memory, up to 64k bytes, into the landing strip at bp. It then sends that data back to the requester. The only time memcpy would not copy all "payload" bytes is if it hit a memory location that it couldn't legally read, in which case a segfault signal would occur.
In your analogy, it would be more like you place your photo down on top of a stack of photos left behind from someone else and then told the owner you had 100 photos. He would dutifully put all 100 photos into a shiny new box and give it to you. It wouldn't matter if the box was empty or not since he will replace all 100 photos.
A segfault would be a case where you dropped your photo on a stack that covered the opening to a garbage disposal and told him you had 100 photos. Unfortunately for the owner there were only 80 photos in the original pile and when he goes to move the 82nd photo, he reaches into the disposal instead. |
|