check for balance between BEGIN: and END: - ics2txt - convert icalendar .ics fi… | |
git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 58d91e5e80aea1ab98f675ccc4530f26a9659162 | |
parent 92a5d0067b717710eb607c0465a8a60d4b4c8655 | |
Author: Josuah Demangeon <[email protected]> | |
Date: Wed, 16 Jun 2021 23:17:45 +0200 | |
check for balance between BEGIN: and END: | |
Diffstat: | |
M ical.c | 7 +++++++ | |
1 file changed, 7 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/ical.c b/ical.c | |
@@ -156,6 +156,8 @@ hook_block_begin(IcalParser *p, char *name) | |
static int | |
hook_block_end(IcalParser *p, char *name) | |
{ | |
+ if (p->current == p->stack) | |
+ return ical_err(p, "more END: than BEGIN:"); | |
if (strcasecmp(p->current->name, name) != 0) | |
return ical_err(p, "mismatching BEGIN: and END:"); | |
p->current--; | |
@@ -319,7 +321,12 @@ ical_parse(IcalParser *p, FILE *fp) | |
} | |
p->linenum += l; | |
} while (l > 0 && (err = ical_parse_contentline(p, contentline)… | |
+ | |
free(contentline); | |
free(line); | |
+ | |
+ if (err == 0 && p->current != p->stack) | |
+ return ical_err(p, "more BEGIN: than END:"); | |
+ | |
return err; | |
} |