-/* $OpenBSD: rrdp_delta.c,v 1.10 2023/12/24 10:48:58 job Exp $ */
+/* $OpenBSD: rrdp_delta.c,v 1.11 2023/12/26 11:03:27 tb Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
enum delta_scope {
DELTA_SCOPE_NONE,
+ DELTA_SCOPE_EMPTY_DELTA,
DELTA_SCOPE_DELTA,
DELTA_SCOPE_PUBLISH,
DELTA_SCOPE_END
if (dxml->current->serial != dxml->serial)
PARSE_FAIL(p, "parse failed - serial mismatch");
- dxml->scope = DELTA_SCOPE_DELTA;
+ dxml->scope = DELTA_SCOPE_EMPTY_DELTA;
}
static void
{
XML_Parser p = dxml->parser;
+ if (dxml->scope == DELTA_SCOPE_EMPTY_DELTA)
+ PARSE_FAIL(p, "parse failed - empty delta");
if (dxml->scope != DELTA_SCOPE_DELTA)
PARSE_FAIL(p, "parse failed - exited delta "
"elem unexpectedely");
int i, hasUri = 0, hasHash = 0;
enum publish_type pub = PUB_UPD;
- if (dxml->scope != DELTA_SCOPE_DELTA)
+ if (dxml->scope != DELTA_SCOPE_EMPTY_DELTA &&
+ dxml->scope != DELTA_SCOPE_DELTA)
PARSE_FAIL(p, "parse failed - entered publish/withdraw "
"elem unexpectedely");
for (i = 0; attr[i]; i += 2) {