[PATCH] Fix incorrect memcpy usage

using memcpy within the same buffer is not safe: replaced such
calls in cmd.c, net_dgrm.c and net_loop.c with memmove calls.

Signed-off-by: O.Sezer <sezero@users.sourceforge.net>
Signed-off-by: Tyrann <tyrann@disenchant.net>
This commit is contained in:
Ozkan Sezer 2007-12-29 10:04:00 +10:30 committed by Tyrann
parent e91ce02db8
commit 86d3942d35
3 changed files with 3 additions and 3 deletions

View File

@ -368,7 +368,7 @@ Datagram_GetMessage(qsocket_t *sock)
}
sock->sendMessageLength -= MAX_DATAGRAM;
if (sock->sendMessageLength > 0) {
memcpy(sock->sendMessage, sock->sendMessage + MAX_DATAGRAM,
memmove(sock->sendMessage, sock->sendMessage + MAX_DATAGRAM,
sock->sendMessageLength);
sock->sendNext = true;
} else {

View File

@ -150,7 +150,7 @@ Loop_GetMessage(qsocket_t *sock)
sock->receiveMessageLength -= length;
if (sock->receiveMessageLength)
memcpy(sock->receiveMessage, &sock->receiveMessage[length],
memmove(sock->receiveMessage, &sock->receiveMessage[length],
sock->receiveMessageLength);
if (sock->driverdata && ret == 1)

View File

@ -196,7 +196,7 @@ Cbuf_Execute(void)
else {
i++;
cmd_text.cursize -= i;
memcpy(text, text + i, cmd_text.cursize);
memmove(text, text + i, cmd_text.cursize);
}
/* execute the command line */