]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pkcs7: Allow for missing optional content field scep-rfc8994
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 28 Jul 2022 05:20:35 +0000 (07:20 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 28 Jul 2022 09:09:17 +0000 (11:09 +0200)
src/libstrongswan/plugins/pkcs7/pkcs7_data.c

index 235b9fe30a9add30c2e0a6e4d4fd93ef2cb43072..98af1380543b7c7c93323fcd7f9fc8e1063ba537 100644 (file)
@@ -60,6 +60,13 @@ METHOD(container_t, get_data, bool,
        chunk_t chunk;
 
        chunk = this->content;
+
+       /* The content field is optional */
+       if (chunk.len == 0)
+       {
+               *data = chunk_empty;
+               return TRUE;
+       }
        if (asn1_unwrap(&chunk, &chunk) == ASN1_OCTET_STRING)
        {
                *data = chunk_clone(chunk);