diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | lib/x509_b64.c | 9 |
2 files changed, 8 insertions, 2 deletions
@@ -5,6 +5,7 @@ Version 0.9.7 - The missing rfc2818_hostname object is now included. - Several corrections and bug fixes in the library by Arne Thomassen <arne@arne-thomassen.de>. +- CR is now allowed in the base64 decoder. Version 0.9.6 (28/06/2003) - Added gnutls_x509_privkey_get_key_id() and gnutls_x509_crt_get_key_id() diff --git a/lib/x509_b64.c b/lib/x509_b64.c index 19d6487037..9adeb0d423 100644 --- a/lib/x509_b64.c +++ b/lib/x509_b64.c @@ -353,12 +353,13 @@ inline static int cpydata(const uint8 * data, int data_size, uint8 ** result) * The result_size is the return value */ #define ENDSTR "-----\n" +#define ENDSTR2 "-----\r\n" int _gnutls_fbase64_decode( const opaque* header, const opaque * data, size_t data_size, uint8 ** result) { int ret; - char top[] = "-----BEGIN "; - char bottom[] = "\n-----END "; + const char top[] = "-----BEGIN "; + const char bottom[] = "\n-----END "; uint8 *rdata; int rdata_size; uint8 *kdata; @@ -385,6 +386,10 @@ int _gnutls_fbase64_decode( const opaque* header, const opaque * data, size_t da } kdata = strnstr( rdata, ENDSTR, data_size); + /* allow CR as well. + */ + if (kdata==NULL) kdata = strnstr( rdata, ENDSTR2, data_size); + if (kdata==NULL) { gnutls_assert(); _gnutls_x509_log( "Could not find '%s'\n", ENDSTR); |