From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sat, 28 Jun 2008 15:47:26 +0000 (+0000)
Subject: fix crash in keys.c clipboard handling
X-Git-Tag: xonotic-v0.1.0preview~2196
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5386aa9ebef174ead3ffd732c133736a11b7edfd;p=xonotic%2Fdarkplaces.git

fix crash in keys.c clipboard handling


git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8379 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/keys.c b/keys.c
index b6747acb..f10679a2 100644
--- a/keys.c
+++ b/keys.c
@@ -284,19 +284,20 @@ Key_Console (int key, char ascii)
 
 	if ((toupper(key) == 'V' && keydown[K_CTRL]) || ((key == K_INS || key == K_KP_INS) && keydown[K_SHIFT]))
 	{
-		char *cbd;
+		char *cbd, *p;
 		if ((cbd = Sys_GetClipboardData()) != 0)
 		{
 			int i;
 #if 1
-			while (*cbd)
+			p = cbd;
+			while (*p)
 			{
-				if (*cbd == '\n' || *cbd == '\r' || *cbd == '\b')
+				if (*p == '\n' || *p == '\r' || *p == '\b')
 				{
-					*cbd++ = 0;
+					*p++ = 0;
 					break;
 				}
-				cbd++;
+				p++;
 			}
 #else
 			strtok(cbd, "\n\r\b");