From 16f952abb866c452a2249fbee24b515c139fb8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 22 Dec 2022 02:13:33 +0000 Subject: [PATCH] Fixed a harmless "Source and destination overlap in memcpy" Fixed a harmess overlap in memcpy() in queue_zero() when the queue itself is empty. If the queue is empty memcpy can be skipped. --- lib/mysql_data_stream.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 28d21c216..35f878688 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -118,7 +118,9 @@ static void __dump_pkt(const char *func, unsigned char *_ptr, unsigned int len) } #define queue_zero(_q) { \ - memcpy(_q.buffer, (unsigned char *)_q.buffer + _q.tail, _q.head - _q.tail); \ + if (_q.tail != 0) { \ + memcpy(_q.buffer, (unsigned char *)_q.buffer + _q.tail, _q.head - _q.tail); \ + } \ _q.head-=_q.tail; \ _q.tail=0; \ }