From: Martin Willi Date: Wed, 17 Jun 2009 11:38:05 +0000 (+0200) Subject: double check that parsing a list consumes all bytes X-Git-Tag: 4.3.2~24 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=80d3a187c5b8d0ea0e88296c48dddaecece837a2;ds=sidebyside double check that parsing a list consumes all bytes --- diff --git a/src/charon/encoding/parser.c b/src/charon/encoding/parser.c index 3e333f7..76ae32f 100644 --- a/src/charon/encoding/parser.c +++ b/src/charon/encoding/parser.c @@ -329,6 +329,12 @@ static bool parse_list(private_parser_t *this, int rule_number, list->insert_last(list, payload); length -= this->byte_pos - pos_before; } + if (length != 0) + { /* must yield exactly to zero */ + DBG1(DBG_ENC, " length of %N substructure list invalid", + payload_type_names, payload_type); + return FALSE; + } *output_pos = list; return TRUE; }