summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-13 23:10:37 -0400
committerpommicket <pommicket@gmail.com>2025-09-13 23:12:46 -0400
commit5a7bce1f14ac3daecb295a2b0aa6c94d8a485921 (patch)
tree50faa770ec9e2293048a004cb2a48ffd899c405d
parente4f62b4ea93b2e1a5fe18366d99d5fa2220eea34 (diff)
Ensure no stray characters after closing quote
-rw-r--r--pom.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pom.c b/pom.c
index abeff17..d0d8406 100644
--- a/pom.c
+++ b/pom.c
@@ -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:;