From abb3f67bd1ad2e417edef0e98c42ea5cc485ae6d Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 10 Nov 2020 18:14:36 +0100 Subject: [PATCH] pem: Make sure we actually parsed some data This could happen if there is no separating empty line between header and body. References #3627. --- src/libstrongswan/plugins/pem/pem_builder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.2