From: John Hodge (sonata) Date: Sun, 20 Jan 2013 13:25:57 +0000 (+0800) Subject: Kernel/fifo - Fixed memory corruption X-Git-Tag: rel0.15~598^2~2 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=7493e50e48d3ad54af804571f05e7a63936a07be;p=tpg%2Facess2.git Kernel/fifo - Fixed memory corruption --- diff --git a/KernelLand/Kernel/drv/fifo.c b/KernelLand/Kernel/drv/fifo.c index 5d344e58..1e6fcdb7 100644 --- a/KernelLand/Kernel/drv/fifo.c +++ b/KernelLand/Kernel/drv/fifo.c @@ -353,11 +353,14 @@ size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buff if(len > pipe->BufSize - pipe->WritePos) { int ofs = pipe->BufSize - pipe->WritePos; + LOG("pipe->Buffer = %p, pipe->WritePos = %i, ofs=%i, len=%i", + pipe->Buffer, pipe->WritePos, ofs, len); memcpy(&pipe->Buffer[pipe->WritePos], Buffer, ofs); - memcpy(&pipe->Buffer, (Uint8*)Buffer + ofs, len-ofs); + memcpy(&pipe->Buffer[0], (Uint8*)Buffer + ofs, len-ofs); } else { + LOG("pipe->Buffer = %p, pipe->WritePos = %i", pipe->Buffer, pipe->WritePos); memcpy(&pipe->Buffer[pipe->WritePos], Buffer, len); }