As the trace shows, the buffers overlap, so use memmove instead of memcpy here.
(gdb) bt
#0 0x000017a3c5eb670a in kill () at <stdin>:2
#1 0x000017a3c5f18089 in abort () at /usr/src/lib/libc/stdlib/abort.c:53
#2 0x000017a3c5eed2b8 in memcpy (dst0=0xf4684, src0=0x6, length=0) at /usr/src/lib/libc/string/memcpy.c:65
#3 0x000017a0c7c45b40 in qwcslcpy (dst=0x17a0cb4e681c, src=0x17a0cb4e681e, size=2048) at q_shared.c:502
#4 0x000017a0c7cc15ac in CL_ParsePrint () at cl_parse.c:2832
#5 0x000017a0c7cc5dbc in CL_ParseServerMessage () at cl_parse.c:3284
#6 0x000017a0c7cbd60c in CL_ReadPackets () at cl_main.c:1666
#7 0x000017a0c7cbf8aa in CL_Frame (time=) at cl_main.c:2423
#8 0x000017a0c7c3fc58 in Host_Frame (time=0.0081969999999955689) at host.c:435
#9 0x000017a0c7d7e6c5 in main (argc=5, argv=0x7f7fffff9838) at sys_posix.c:319
Current language: auto; currently asm
Fix:
--- q_shared.c.orig Thu Dec 4 16:01:14 2014
+++ q_shared.c Thu Dec 4 16:01:27 2014
@@ -499,7 +499,7 @@
if (len < size) {
// it'll fit
- memcpy (dst, src, (len + 1) * sizeof(wchar));
+ memmove (dst, src, (len + 1) * sizeof(wchar));
return len;
}
(gdb) bt
#0 0x000017a3c5eb670a in kill () at <stdin>:2
#1 0x000017a3c5f18089 in abort () at /usr/src/lib/libc/stdlib/abort.c:53
#2 0x000017a3c5eed2b8 in memcpy (dst0=0xf4684, src0=0x6, length=0) at /usr/src/lib/libc/string/memcpy.c:65
#3 0x000017a0c7c45b40 in qwcslcpy (dst=0x17a0cb4e681c, src=0x17a0cb4e681e, size=2048) at q_shared.c:502
#4 0x000017a0c7cc15ac in CL_ParsePrint () at cl_parse.c:2832
#5 0x000017a0c7cc5dbc in CL_ParseServerMessage () at cl_parse.c:3284
#6 0x000017a0c7cbd60c in CL_ReadPackets () at cl_main.c:1666
#7 0x000017a0c7cbf8aa in CL_Frame (time=) at cl_main.c:2423
#8 0x000017a0c7c3fc58 in Host_Frame (time=0.0081969999999955689) at host.c:435
#9 0x000017a0c7d7e6c5 in main (argc=5, argv=0x7f7fffff9838) at sys_posix.c:319
Current language: auto; currently asm
Fix:
--- q_shared.c.orig Thu Dec 4 16:01:14 2014
+++ q_shared.c Thu Dec 4 16:01:27 2014
@@ -499,7 +499,7 @@
if (len < size) {
// it'll fit
- memcpy (dst, src, (len + 1) * sizeof(wchar));
+ memmove (dst, src, (len + 1) * sizeof(wchar));
return len;
}