1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 07:02:30 +01:00

WPrefs: fix possible crash when saving mouse modifier (Coverity #50098)

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.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-31 19:58:41 +02:00
committed by Carlos R. Mafra
parent 4b7bb5bc5c
commit dc2a991e21

View File

@@ -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");