mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Accept a trailing space at end of PEM lines
With certs being copy-pasted from webmails and all, this will probably become more and more common. closes #226
This commit is contained in:
@ -236,12 +236,14 @@ int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *header, const
|
||||
return( MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT );
|
||||
|
||||
s1 += strlen( header );
|
||||
if( *s1 == ' ' ) s1++;
|
||||
if( *s1 == '\r' ) s1++;
|
||||
if( *s1 == '\n' ) s1++;
|
||||
else return( MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT );
|
||||
|
||||
end = s2;
|
||||
end += strlen( footer );
|
||||
if( *end == ' ' ) end++;
|
||||
if( *end == '\r' ) end++;
|
||||
if( *end == '\n' ) end++;
|
||||
*use_len = end - data;
|
||||
|
Reference in New Issue
Block a user