1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

WPrefs: Add check for invalid OPEN_MENU/EXEC in PL-Menu to avoid potential crash

As reported by Coverity (CID #50047, #50048), if the proplist is incorrect
and has an OPEN_MENU or (SH)EXEC command without its arguments, we did
dereference a NULL pointer.
Now we simply return the NULL value, appropriate to have the caller of the
function issue a message.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2021-05-16 15:47:07 +02:00
committed by Carlos R. Mafra
parent 29cf48b934
commit 8e47ca8e62

View File

@@ -914,6 +914,11 @@ static ItemData *parseCommand(WMPropList * item)
data->type = ExecInfo;
if (parameter == NULL) {
wfree(data);
return NULL;
}
data->param.exec.command = wstrdup(parameter);
if (shortcut)
data->param.exec.shortcut = wstrdup(shortcut);
@@ -926,6 +931,12 @@ static ItemData *parseCommand(WMPropList * item)
* |pipe
*/
p = parameter;
if (p == NULL) {
wfree(data);
return NULL;
}
while (isspace(*p) && *p)
p++;
if (*p == '|') {