From e7bcf3d8a0c83cc7bc3970087beab47a7c7a14bd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 29 Nov 2014 19:11:47 +0100 Subject: mds-kbdc: check that there is something after the : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/make-tree.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mds-kbdc/make-tree.c b/src/mds-kbdc/make-tree.c index 26ee0a7..cdfae40 100644 --- a/src/mds-kbdc/make-tree.c +++ b/src/mds-kbdc/make-tree.c @@ -901,6 +901,7 @@ int parse_to_tree(const char* restrict filename, mds_kbdc_parsed_t* restrict res else if (strchr("\\\"<([0123456789", *line)) { size_t stack_orig = stack_ptr + 1; + char* colon; #define node supernode #define inner sequence NEW_NODE(map, MAP); @@ -915,10 +916,10 @@ int parse_to_tree(const char* restrict filename, mds_kbdc_parsed_t* restrict res stack_ptr--; *end = prev_end_char; SKIP_SPACES(line); - if (*line++ != ':') + if (colon = line, *line++ != ':') { LEAF; - continue; /* Not an error in macros. */ + continue; /* Not an error in functions. */ } BRANCH(":"); #undef inner @@ -931,6 +932,12 @@ int parse_to_tree(const char* restrict filename, mds_kbdc_parsed_t* restrict res #define node supernode LEAF; #undef node + if (supernode->result == NULL) + { + NEW_ERROR(1, ERROR, "output missing"); + error->start = (size_t)(colon - LINE); + error->end = error->start + 1; + } if (*line == '\0') continue; end = line + strlen(line), prev_end_char = *end; -- cgit v1.2.3-70-g09d2