Package: xevil
Version: 2.02r2-9
Tags: patch

xevil does not always read X resources correctly for the definition of keyboard 
mappings. This is because of the use of invalid memory in the routine 
Game::process_x_resources(). The "option" char pointer points to memory 
provided by a temporary string object that has gone out of scope when "option" 
is used. This bug is only noticeable for certain implementations of STL on the 
compiler platform. Here is a suggested fix:

--- a/cmn/game.cpp
+++ b/cmn/game.cpp
@@ -2254,10 +2254,10 @@ void Game::process_x_resources(int *,char **)
               strm << "right_" << keysNames[n];
             else
               strm << "right_" << keysNames[n] << "_2";
-            const char *option = strm.str().c_str();
+            string option = strm.str();
             
             // Should we free value??
-            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option);
+            char *value = 
XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str());
             if (value) {
               KeySym keysym = XStringToKeysym(value);
               if (keysym != NoSymbol)
@@ -2273,10 +2273,10 @@ void Game::process_x_resources(int *,char **)
               strm << "left_" << keysNames[n];
             else
               strm << "left_" << keysNames[n] << "_2";
-            const char *option = strm.str().c_str();
+            string option = strm.str();
             
             // Should we free value??
-            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option);
+            char *value = 
XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str());
             if (value) {
               KeySym keysym = XStringToKeysym(value);
               if (keysym != NoSymbol)

Reply via email to