summaryrefslogtreecommitdiff
path: root/src/openvpn/base64.c
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2017-06-22 13:16:46 +0200
committerAlberto Gonzalez Iniesta <agi@inittab.org>2017-06-22 13:16:46 +0200
commit766cdd4b4d1fcb31addf6727dbcfd3d99e390456 (patch)
tree76932876ae57f139fa1b3f82b375e4e526b507d7 /src/openvpn/base64.c
parentd73f7253d939e293abf9e27b4b7f37df1ec12a39 (diff)
parent9683f890944ffb114f5f8214f694e0b339cf5a5a (diff)
Merge tag 'upstream/2.4.3'
Upstream version 2.4.3
Diffstat (limited to 'src/openvpn/base64.c')
-rw-r--r--src/openvpn/base64.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/openvpn/base64.c b/src/openvpn/base64.c
index c799ede..0ac65e9 100644
--- a/src/openvpn/base64.c
+++ b/src/openvpn/base64.c
@@ -69,7 +69,8 @@ openvpn_base64_encode(const void *data, int size, char **str)
}
q = (const unsigned char *) data;
i = 0;
- for (i = 0; i < size; ) {
+ for (i = 0; i < size; )
+ {
c = q[i++];
c *= 256;
if (i < size)
@@ -107,10 +108,12 @@ pos(char c)
{
char *p;
for (p = base64_chars; *p; p++)
+ {
if (*p == c)
{
return p - base64_chars;
}
+ }
return -1;
}
@@ -126,7 +129,8 @@ token_decode(const char *token)
{
return DECODE_ERROR;
}
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++)
+ {
val *= 64;
if (token[i] == '=')
{
@@ -164,7 +168,8 @@ openvpn_base64_decode(const char *str, void *data, int size)
{
e = q + size;
}
- for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4) {
+ for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4)
+ {
unsigned int val = token_decode(p);
unsigned int marker = (val >> 24) & 0xff;
if (val == DECODE_ERROR)