aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0001-use-memmove-for-copying-buffer-leftovers-as-the-rang.patch
blob: 079b00ab1b1250887c0aaa0551ab350e45c747f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 60dd5798c90f0032b5c477bd35a2e0d49c280c7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 8 Apr 2015 16:58:20 +0300
Subject: [PATCH] use memmove for copying buffer leftovers, as the ranges may
 overlap

issue cought by fortify
---
 src/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/io.c b/src/io.c
index e9d95df..765afc5 100644
--- a/src/io.c
+++ b/src/io.c
@@ -224,7 +224,7 @@ static apk_blob_t is_bs_read(void *stream, apk_blob_t token)
 
 	/* We need more data */
 	if (isbs->left.len != 0)
-		memcpy(isbs->buffer, isbs->left.ptr, isbs->left.len);
+		memmove(isbs->buffer, isbs->left.ptr, isbs->left.len);
 	isbs->left.ptr = isbs->buffer;
 	size = isbs->is->read(isbs->is, isbs->buffer + isbs->left.len,
 			      sizeof(isbs->buffer) - isbs->left.len);
-- 
2.3.5