From 8cd4b77a1e8d86d1e54dd48f0c1c5d4561b51691 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Tue, 8 Feb 2011 23:16:03 +0000 Subject: [PATCH] Fix strcpy copying buffer into itself, thanks to Simon McVittie for reporting and the patch (#4894) --- code/game/ai_dmq3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/ai_dmq3.c b/code/game/ai_dmq3.c index 40cfe141..a82100ae 100644 --- a/code/game/ai_dmq3.c +++ b/code/game/ai_dmq3.c @@ -1488,7 +1488,8 @@ char *EasyClientName(int client, char *buf, int size) { char *str1, *str2, *ptr, c; char name[128]; - strcpy(name, ClientName(client, name, sizeof(name))); + ClientName(client, name, sizeof(name)); + for (i = 0; name[i]; i++) name[i] &= 127; //remove all spaces for (ptr = strstr(name, " "); ptr; ptr = strstr(name, " ")) {