> From: Anthony J. Bentley <anth...@cathet.us>
> Date: Tue, Jan 20, 2015 at 1:03 PM
> Subject: backwards memcpy in xscorch
> To: ports@openbsd.org
> 
> 
> $ gdb xscorch
> GNU gdb 6.3
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "amd64-unknown-openbsd5.7"...
> (gdb) run
> Starting program: /usr/local/bin/xscorch
> XScorch version 0.2.1-pre2
> Copyright(c) 2000-2004 Justin David Smith
> Copyright(c) 2000-2009 Jacob Luna Lundberg
> Licensed under the GNU General Public License, version 2
> See the Help menu for the license and a list of contributors.
> 
> Program received signal SIGABRT, Aborted.
> 0x00000cf3261339ea in kill () at <stdin>:2
> 2       <stdin>: No such file or directory.
>         in <stdin>
> Current language:  auto; currently asm
> (gdb) bt
> #0  0x00000cf3261339ea in kill () at <stdin>:2
> #1  0x00000cf32616d1c9 in abort () at /usr/src/lib/libc/stdlib/abort.c:53
> #2  0x00000cf3261422f8 in memcpy (dst0=0xf754d, src0=0x6, length=0)
>     at /usr/src/lib/libc/string/memcpy.c:65
> #3  0x00000cf117449e62 in trim (s=0x7f7ffffec490 " tank_profile_class ")
>     at str_trim.c:50
> #4  0x00000cf1174473aa in _sc_line_is_assignment (
>     buf=0x7f7ffffee490 "Standard = tank_profile_class ",
>     var=0x7f7ffffed490 "Standard", val=0x7f7ffffec490 " tank_profile_class ")
>     at regio.c:50
> #5  0x00000cf11744745e in _sc_line_is_block_begin (r=0xcf3cef81b80,
>     buf=0x7f7ffffee490 "Standard = tank_profile_class ",
>     name=0x7f7ffffed490 "Standard",
>     klass=0x7f7ffffec490 " tank_profile_class ") at regio.c:71
> #6  0x00000cf117447804 in reg_load (r=0xcf3cef81b80) at regio.c:193
> #7  0x00000cf117417d17 in sc_tank_profile_add (plist=0xcf3828d8048,
>     datafile=0xcf11754a2c0 "/usr/local/share/xscorch//profiles.def")
>     at stankpro.c:254
> #8  0x00000cf11740a28e in sc_config_new (argc=0x7f7fffff15dc,
>     argv=0x7f7fffff15d0) at sconfig.c:155
> #9  0x00000cf117409a79 in main (argc=1, argv=0x7f7fffff1668) at xscorch.c:86

Does the patch below work for you?

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/xscorch/Makefile,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 Makefile
--- Makefile    21 Mar 2013 08:45:17 -0000      1.14
+++ Makefile    20 Jan 2015 12:24:16 -0000
@@ -3,7 +3,7 @@
 COMMENT=               Scorched Earth-clone
 
 DISTNAME=              xscorch-0.2.1-pre2
-REVISION=              3
+REVISION=              4
 CATEGORIES=            games
 
 HOMEPAGE=              http://www.xscorch.org/
Index: patches/patch-libj_jstr_str_trim_c
===================================================================
RCS file: patches/patch-libj_jstr_str_trim_c
diff -N patches/patch-libj_jstr_str_trim_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-libj_jstr_str_trim_c  20 Jan 2015 12:24:16 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- libj/jstr/str_trim.c.orig  Tue Jan 20 06:08:43 2015
++++ libj/jstr/str_trim.c       Tue Jan 20 06:09:18 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);
+ 

Reply via email to