From: Christophe CURIS <christophe.cu...@free.fr>

As pointed by Coverity, there is a possible NULL pointer dereference in the
code that extracts the selected modifier (from a popup button list).

The code assumes that there is always a space between the core name of the
modifier (which is used for saving) and the more user friendly name. This
is true if the list could be successfully generated in fillModifierPopUp,
but it may not be the case if that function has to fall-back to the
default list (XGetModifierMaping failure).

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WPrefs.app/MouseSettings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index 31d467d..cb767e6 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -768,7 +768,8 @@ static void storeData(_Panel * panel)
        tmp = WMGetPopUpButtonItem(panel->grabP, 
WMGetPopUpButtonSelectedItem(panel->grabP));
        tmp = wstrdup(tmp);
        p = strchr(tmp, ' ');
-       *p = 0;
+       if (p != NULL)
+               *p = '\0';
 
        SetStringForKey(tmp, "ModifierKey");
 
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to