zlib/backport-Avoid-an-undefined-behavior-of-memcpy-in-gzappend.patch
zhoupengcheng fce1c5536a zlib:backport upstream patch
(cherry picked from commit ee65ab90886d1240dc7ef6b6afc98012d7c18b2a)
2024-05-07 19:57:31 +08:00

28 lines
847 B
Diff

From ae49d1472ec176ddc53a3a4905f91d46344386e6 Mon Sep 17 00:00:00 2001
From: Mark Adler <zlib@madler.net>
Date: Thu, 12 Oct 2017 19:27:59 -0700
Subject: [PATCH] Avoid an undefined behavior of memcpy() in gzappend().
Reference:https://github.com/madler/zlib/commit/ae49d1472ec176ddc53a3a4905f91d46344386e6
Conflict:NA
---
examples/gzappend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/gzappend.c b/examples/gzappend.c
index 662dec3..d7eea3e 100644
--- a/examples/gzappend.c
+++ b/examples/gzappend.c
@@ -137,7 +137,7 @@ local void rotate(unsigned char *list, unsigned len, unsigned rot)
/* do simple left shift by one */
if (rot == 1) {
tmp = *list;
- memcpy(list, list + 1, len - 1);
+ memmove(list, list + 1, len - 1);
*last = tmp;
return;
}
--
2.23.0