pem: Don't read beyond line ends

This commit is contained in:
Tobias Brunner
2017-05-23 18:29:11 +02:00
parent 388351609d
commit 30c03a7df9
+2 -2
View File
@@ -61,7 +61,7 @@ static bool find_boundary(char* tag, chunk_t *line)
if (!present("-----", line) || if (!present("-----", line) ||
!present(tag, line) || !present(tag, line) ||
*line->ptr != ' ') !line->len || *line->ptr != ' ')
{ {
return FALSE; return FALSE;
} }
@@ -306,7 +306,7 @@ static status_t pem_to_bin(chunk_t *blob, bool *pgp)
} }
/* check for PGP armor checksum */ /* check for PGP armor checksum */
if (*data.ptr == '=') if (data.len && *data.ptr == '=')
{ {
*pgp = TRUE; *pgp = TRUE;
data.ptr++; data.ptr++;