fix crash in keys.c clipboard handling
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 28 Jun 2008 15:47:26 +0000 (15:47 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 28 Jun 2008 15:47:26 +0000 (15:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8379 d7cf8633-e32d-0410-b094-e92efae38249

keys.c

diff --git a/keys.c b/keys.c
index b6747ac..f10679a 100644 (file)
--- 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");