From 6b23fb887e499c035c040d86a55fb8ea235d659b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 21 Dec 2004 18:20:55 +0000 Subject: [PATCH] memcpy() is not safe if source and destination are overlapping. --- src/common/wavpack_common.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/common/wavpack_common.cpp b/src/common/wavpack_common.cpp index a36840118..c3ea7dd24 100644 --- a/src/common/wavpack_common.cpp +++ b/src/common/wavpack_common.cpp @@ -64,9 +64,8 @@ read_next_header(mm_io_c *mm_io, while (1) { if (sp < ep) { bleft = ep - sp; - memcpy(buffer, sp, bleft); - } - else + memmove(buffer, sp, bleft); + } else bleft = 0; if (mm_io->read(buffer + bleft, sizeof(*wphdr) - bleft) !=