diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2015-07-31 11:09:59 +0200 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg2@elzevir.fr> | 2015-08-10 16:43:28 +0200 |
commit | faf44abf2aedd83dbd0e2d5e43182847bc5f2cd1 (patch) | |
tree | 2e4e88703a44de3d582ef2ef6989c741ee99b2bc | |
parent | ebb9cf9cc682bde8a53c1320688cb360e4c5cd00 (diff) | |
download | mbedtls-faf44abf2aedd83dbd0e2d5e43182847bc5f2cd1.zip mbedtls-faf44abf2aedd83dbd0e2d5e43182847bc5f2cd1.tar.gz mbedtls-faf44abf2aedd83dbd0e2d5e43182847bc5f2cd1.tar.bz2 |
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.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | library/pem.c | 2 |
2 files changed, 3 insertions, 0 deletions
@@ -19,6 +19,7 @@ Bugfix Changes * Add SSL_MIN_DHM_BYTES configuration parameter in config.h to choose the minimum size of Diffie-Hellman parameters accepted by the client. + * The PEM parser now accepts a trailing space at end of lines (#226). = Version 1.2.14 released 2015-06-26 diff --git a/library/pem.c b/library/pem.c index 4f853b5..5c973ac 100644 --- a/library/pem.c +++ b/library/pem.c @@ -208,12 +208,14 @@ int pem_read_buffer( pem_context *ctx, char *header, char *footer, const unsigne return( POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT ); s1 += strlen( header ); + if( *s1 == ' ' ) s1++; if( *s1 == '\r' ) s1++; if( *s1 == '\n' ) s1++; else return( POLARSSL_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; |