summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-08-20 22:21:32 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-08-20 22:21:32 +0000
commit94f0a3f9c1a1c8798681ffbe7f32097f4b1723d0 (patch)
treeea2e6c13d04994de9cf234f02900fe8d22418b36
parentccb8d1647c9cdb4cc2b235ba455bbb1c51ce048e (diff)
downloadgnutls-94f0a3f9c1a1c8798681ffbe7f32097f4b1723d0.tar.gz
CR is now allowed in the base64 decoder.
-rw-r--r--NEWS1
-rw-r--r--lib/x509_b64.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index fa0e579d6a..d845f93b84 100644
--- a/NEWS
+++ b/NEWS
@@ -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);