Commit dc2dbb7f authored by Mark Karpilovskij's avatar Mark Karpilovskij

libknot: added error code for unexpected trailing data

parent e8974fa5
...@@ -90,6 +90,7 @@ enum knot_error { ...@@ -90,6 +90,7 @@ enum knot_error {
KNOT_ESYSTEM, KNOT_ESYSTEM,
KNOT_EFILE, KNOT_EFILE,
KNOT_ESOAINVAL, KNOT_ESOAINVAL,
KNOT_ETRAIL,
/* Control states. */ /* Control states. */
KNOT_CTL_ESTOP, KNOT_CTL_ESTOP,
......
...@@ -90,6 +90,7 @@ static const struct error errors[] = { ...@@ -90,6 +90,7 @@ static const struct error errors[] = {
{ KNOT_ESYSTEM, "system error" }, { KNOT_ESYSTEM, "system error" },
{ KNOT_EFILE, "file error" }, { KNOT_EFILE, "file error" },
{ KNOT_ESOAINVAL, "SOA mismatch" }, { KNOT_ESOAINVAL, "SOA mismatch" },
{ KNOT_ETRAIL, "trailing data" },
/* Control states. */ /* Control states. */
{ KNOT_CTL_ESTOP, "stopping server" }, { KNOT_CTL_ESTOP, "stopping server" },
......
...@@ -771,7 +771,7 @@ int knot_pkt_parse_payload(knot_pkt_t *pkt, unsigned flags) ...@@ -771,7 +771,7 @@ int knot_pkt_parse_payload(knot_pkt_t *pkt, unsigned flags)
/* Check for trailing garbage. */ /* Check for trailing garbage. */
if (pkt->parsed < pkt->size) { if (pkt->parsed < pkt->size) {
return KNOT_EMALF; return KNOT_ETRAIL;
} }
return KNOT_EOK; return KNOT_EOK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment