From ee61bd5adff8422624fd3c6baa78a3044538746d Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 16 May 2011 09:56:46 +0200 Subject: [PATCH] allow newlines in base64Valid check --- moonshot/mech_eap/util_base64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/moonshot/mech_eap/util_base64.c b/moonshot/mech_eap/util_base64.c index 134b2cc..aaa1ea8 100644 --- a/moonshot/mech_eap/util_base64.c +++ b/moonshot/mech_eap/util_base64.c @@ -144,15 +144,18 @@ base64Decode(const char *str, void *data) int base64Valid(const char *str) { - const char *p; + const char *p = str; int valid = 1; - for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4) { + while (*p && *p && (*p == '=' || strchr(base64_chars, *p))) { unsigned int val = token_decode(p); if (val == DECODE_ERROR) { valid = 0; break; } + p += 4; + if (*p == '\n') + p++; } return valid; } -- 2.1.4