Replace overlapping memcpy with memmove

Breakage spotted by bentley@, who forgot to reply to my request for
feedback
This commit is contained in:
dcoppa 2015-01-24 12:34:06 +00:00
parent 968ddbc872
commit 5b6297fead
2 changed files with 17 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.14 2013/03/21 08:45:17 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.15 2015/01/24 12:34:06 dcoppa Exp $
COMMENT= Scorched Earth-clone
DISTNAME= xscorch-0.2.1-pre2
REVISION= 3
REVISION= 4
CATEGORIES= games
HOMEPAGE= http://www.xscorch.org/

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-libj_jstr_str_trim_c,v 1.1 2015/01/24 12:34:07 dcoppa Exp $
Replace overlapping memcpy with memmove
--- libj/jstr/str_trim.c.orig Sat Jan 24 13:32:27 2015
+++ libj/jstr/str_trim.c Sat Jan 24 13:32:45 2015
@@ -47,7 +47,7 @@ char *trim(char *s) {
SET_LAST_NWS(ws, s);
/* Copy the non-ws characters in <s>. */
- if(ws.fnws > d) MEMCPY(d, ws.fnws, NWS_SIZE(ws));
+ if(ws.fnws > d) MEMMOVE(d, ws.fnws, NWS_SIZE(ws));
*(d + NWS_SIZE(ws)) = '\0';
return(d);