From: Tobias Brunner Date: Wed, 29 Mar 2017 09:19:30 +0000 (+0200) Subject: pem: Don't read beyond line ends X-Git-Tag: 5.5.3~26^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30c03a7df9a638b3c94d0405dd40a9fa1a57832c;p=thirdparty%2Fstrongswan.git pem: Don't read beyond line ends --- diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index 719a2a69e0..cda7037416 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -61,7 +61,7 @@ static bool find_boundary(char* tag, chunk_t *line) if (!present("-----", line) || !present(tag, line) || - *line->ptr != ' ') + !line->len || *line->ptr != ' ') { return FALSE; } @@ -306,7 +306,7 @@ static status_t pem_to_bin(chunk_t *blob, bool *pgp) } /* check for PGP armor checksum */ - if (*data.ptr == '=') + if (data.len && *data.ptr == '=') { *pgp = TRUE; data.ptr++;