shithub: choc

Download patch

ref: 1dfad75870fa6b8e0a3aa41b3f9bb6ea260c9d9f
parent: f9c922149717242958f065c8718e7e7586c165a5
author: Simon Howard <[email protected]>
date: Fri Nov 20 19:38:16 EST 2009

Don't crash if key settings are set in a configuration file that are out
of range (thanks entryway).

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1732

--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1237,7 +1237,14 @@
 
                     intparm = ParseIntParameter(strparm);
                     defaults[i].untranslated = intparm;
-                    intparm = scantokey[intparm];
+                    if (intparm >= 0 && intparm < 128)
+                    {
+                        intparm = scantokey[intparm];
+                    }
+                    else
+                    {
+                        intparm = 0;
+                    }
 
                     defaults[i].original_translated = intparm;
                     * (int *) def->location = intparm;