1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 13:24:14 +01:00

Coverity: fix menuparser_macro uninitialized pointer read

This commit is contained in:
David Maciejak
2023-03-01 06:03:04 +08:00
committed by Carlos R. Mafra
parent c8883fdbb0
commit 77df89396c

View File

@@ -167,6 +167,7 @@ void menu_parser_define_macro(WMenuParser parser)
return; return;
} }
macro = wmalloc(sizeof(*macro)); macro = wmalloc(sizeof(*macro));
memset(arg_name, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
/* Isolate name of macro */ /* Isolate name of macro */
idx = 0; idx = 0;
@@ -392,6 +393,8 @@ void menu_parser_expand_macro(WMenuParser parser, WParserMacro *macro)
unsigned int size; unsigned int size;
int i, space_left; int i, space_left;
memset(arg_value, 0, MAX_MACRO_ARG_COUNT * sizeof(char *));
/* Skip the name of the macro, this was not done by caller */ /* Skip the name of the macro, this was not done by caller */
for (i = 0; macro->name[i] != '\0'; i++) for (i = 0; macro->name[i] != '\0'; i++)
parser->rd++; parser->rd++;