From: Luke Howard Date: Mon, 16 May 2011 07:56:46 +0000 (+0200) Subject: allow newlines in base64Valid check X-Git-Tag: tr-beta1~157 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=commitdiff_plain;h=ee61bd5adff8422624fd3c6baa78a3044538746d allow newlines in base64Valid check --- 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; }