changeset 79563:fb6105cb466b

(w32_wnd_proc, Fw32_reconstruct_hot_key): Range check before dereferencing array. (lookup_vk_code): Remove zero comparison.
author Jason Rumney <jasonr@gnu.org>
date Thu, 13 Dec 2007 15:52:38 +0000
parents 8ced7f18a0a4
children 875cbbe0f09c
files src/w32fns.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Wed Dec 12 10:12:51 2007 +0000
+++ b/src/w32fns.c	Thu Dec 13 15:52:38 2007 +0000
@@ -2956,7 +2956,7 @@
 	     they don't produce WM_CHAR messages).  This ensures that
 	     indicator lights are toggled promptly on Windows 9x, for
 	     example.  */
-	  if (lispy_function_keys[wParam] != 0)
+	  if (wParam < 256 && lispy_function_keys[wParam])
 	    {
 	      windows_translate = 1;
 	      goto translate;
@@ -3078,7 +3078,7 @@
 	  break;
 	default:
 	  /* If not defined as a function key, change it to a WM_CHAR message. */
-	  if (lispy_function_keys[wParam] == 0)
+	  if (wParam > 255 || !lispy_function_keys[wParam])
 	    {
 	      DWORD modifiers = construct_console_modifiers ();
 
@@ -8129,7 +8129,7 @@
   int i;
 
   for (i = 0; i < 256; i++)
-    if (lispy_function_keys[i] != 0
+    if (lispy_function_keys[i]
 	&& strcmp (lispy_function_keys[i], key) == 0)
       return i;
 
@@ -8307,7 +8307,7 @@
   vk_code = HOTKEY_VK_CODE (hotkeyid);
   w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
 
-  if (lispy_function_keys[vk_code])
+  if (vk_code < 256 && lispy_function_keys[vk_code])
     key = intern (lispy_function_keys[vk_code]);
   else
     key = make_number (vk_code);