From fea3aa5d12a7ab90df762256010f8be468d6a5ae Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Wed, 10 Nov 2010 15:34:38 +0100 Subject: [PATCH] Check for exceeded payload count even if we have a found one flagged as sufficient --- src/libcharon/encoding/message.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c index f4cb5b0e1..913b57c62 100644 --- a/src/libcharon/encoding/message.c +++ b/src/libcharon/encoding/message.c @@ -1295,6 +1295,7 @@ static status_t decrypt_payloads(private_message_t *this, aead_t *aead) */ static status_t verify(private_message_t *this) { + bool complete = FALSE; int i; DBG2(DBG_ENC, "verifying message structure"); @@ -1343,15 +1344,15 @@ static status_t verify(private_message_t *this) } enumerator->destroy(enumerator); - if (found < rule->min_occurence) + if (!complete && found < rule->min_occurence) { DBG1(DBG_ENC, "payload of type %N not occured %d times (%d)", payload_type_names, rule->type, rule->min_occurence, found); return VERIFY_ERROR; } - if (rule->sufficient) + if (found && rule->sufficient) { - return SUCCESS; + complete = TRUE; } } return SUCCESS;