From de10512a492dda844e50222de03357649e716800 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 1 Apr 2016 11:44:17 +0200 Subject: [PATCH] output.c: cmd_output: Check return values of lex_force_match --- src/language/utilities/output.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/language/utilities/output.c b/src/language/utilities/output.c index fc390992b9..45aa638743 100644 --- a/src/language/utilities/output.c +++ b/src/language/utilities/output.c @@ -100,8 +100,11 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) { if (lex_match_id (lexer, "SELECT")) { - lex_force_match (lexer, T_EQUALS); - lex_force_match (lexer, T_LBRACK); + if (! lex_force_match (lexer, T_EQUALS)) + goto error; + + if (! lex_force_match (lexer, T_LBRACK)) + goto error; while (lex_token (lexer) != T_RBRACK && lex_token (lexer) != T_ENDCMD) @@ -122,7 +125,8 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) goto error; } } - lex_force_match (lexer, T_RBRACK); + if (! lex_force_match (lexer, T_RBRACK)) + goto error; } else if (lex_match_id (lexer, "FORMAT")) { @@ -131,7 +135,8 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) int width = -1; int decimals = -1; - lex_force_match (lexer, T_EQUALS); + if (! lex_force_match (lexer, T_EQUALS)) + goto error; if (! parse_abstract_format_specifier (lexer, type, &width, &decimals)) { lex_error (lexer, NULL); -- 2.30.2