pem: Don't read beyond line ends

This commit is contained in:
Tobias Brunner 2017-03-29 11:19:30 +02:00
parent 388351609d
commit 30c03a7df9

View File

@ -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++;