File: 0010-Prevent-undefined-behaviour-in-memcpy-parameter-over.patch

package info (click to toggle)
docbook-to-man 1%3A2.0.0-49
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,824 kB
  • sloc: ansic: 5,843; makefile: 155; sh: 28
file content (29 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (3)
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
28
29
From: Chris Lamb <lamby@debian.org>
Date: Fri, 12 May 2017 10:58:54 +0200
Subject: Prevent undefined behaviour in memcpy parameter overlap.

On i386 (but not armhf or amd64), docbook-to-man inserts random
characters into the output. e.g. it will sometimes generate an "I"
instead of a literal tab.

Thanks to Chris West <solo-debianbugs@goeswhere.com> and Yuri Gribov
<tetra2005@gmail.com>

Debian-Bugs: #842635 #858389
---
 Instant/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Instant/main.c b/Instant/main.c
index 64a5e96..0341670 100644
--- a/Instant/main.c
+++ b/Instant/main.c
@@ -796,7 +796,7 @@ ReadESIS(
 			if ( ! buf[2] )
 				break;
 			buf[0] = ' ';
-			memcpy(&buf[1], &buf[2], strlen(buf)-1);
+			memmove(&buf[1], &buf[2], strlen(buf)-1);
 		}
 
 		cont[ncont].ch.data = strdup(buf);