diff options
author | pommicket <pommicket@gmail.com> | 2025-09-13 23:10:37 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-13 23:12:46 -0400 |
commit | 5a7bce1f14ac3daecb295a2b0aa6c94d8a485921 (patch) | |
tree | 50faa770ec9e2293048a004cb2a48ffd899c405d /pom.c | |
parent | e4f62b4ea93b2e1a5fe18366d99d5fa2220eea34 (diff) |
Ensure no stray characters after closing quote
Diffstat (limited to 'pom.c')
-rw-r--r-- | pom.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -679,8 +679,16 @@ parse_quoted_value(struct parser *parser, const char *first_line) { while (!parser->eof && !parser->out_of_memory) { char c; while ((c = *line++)) { - if (c == delimiter) + if (c == delimiter) { + while ((c = *line++)) { + if (c != ' ' && c != '\t') { + parser_error(parser, + "Stray characters after closing %c", + delimiter); + } + } goto finish; + } if (c == '\\') { parse_escape_sequence(parser, &line); } else { @@ -688,9 +696,7 @@ parse_quoted_value(struct parser *parser, const char *first_line) { } } parser_read_line(parser); - char *newline = parser_append_one(parser, string_data); - if (!newline) return; - *newline = '\n'; + parser_append_char(parser, '\n'); line = parser->line.array; } finish:; |