From: Tobias Brunner Date: Tue, 10 Nov 2020 17:14:36 +0000 (+0100) Subject: pem: Make sure we actually parsed some data X-Git-Tag: 5.9.2dr1~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=abb3f67bd1ad2e417edef0e98c42ea5cc485ae6d;p=thirdparty%2Fstrongswan.git pem: Make sure we actually parsed some data This could happen if there is no separating empty line between header and body. References #3627. --- diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index e9d464fe57..3b84eb7eaf 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -330,7 +330,7 @@ static status_t pem_to_bin(chunk_t *blob, bool *pgp) /* set length to size of binary blob */ blob->len = dst.len; - if (state != PEM_POST) + if (state != PEM_POST || !blob->len) { DBG1(DBG_LIB, " file coded in unknown format, discarded"); return PARSE_ERROR;