mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +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:
committed by
Carlos R. Mafra
parent
29cf48b934
commit
8e47ca8e62
@@ -914,6 +914,11 @@ static ItemData *parseCommand(WMPropList * item)
|
|||||||
|
|
||||||
data->type = ExecInfo;
|
data->type = ExecInfo;
|
||||||
|
|
||||||
|
if (parameter == NULL) {
|
||||||
|
wfree(data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
data->param.exec.command = wstrdup(parameter);
|
data->param.exec.command = wstrdup(parameter);
|
||||||
if (shortcut)
|
if (shortcut)
|
||||||
data->param.exec.shortcut = wstrdup(shortcut);
|
data->param.exec.shortcut = wstrdup(shortcut);
|
||||||
@@ -926,6 +931,12 @@ static ItemData *parseCommand(WMPropList * item)
|
|||||||
* |pipe
|
* |pipe
|
||||||
*/
|
*/
|
||||||
p = parameter;
|
p = parameter;
|
||||||
|
|
||||||
|
if (p == NULL) {
|
||||||
|
wfree(data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
while (isspace(*p) && *p)
|
while (isspace(*p) && *p)
|
||||||
p++;
|
p++;
|
||||||
if (*p == '|') {
|
if (*p == '|') {
|
||||||
|
|||||||
Reference in New Issue
Block a user