diff options
Diffstat (limited to 'doc/examples/tlsauthentication.c')
-rw-r--r-- | doc/examples/tlsauthentication.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c index 5b2dec1d..d7ddbd43 100644 --- a/doc/examples/tlsauthentication.c +++ b/doc/examples/tlsauthentication.c | |||
@@ -53,8 +53,10 @@ string_to_base64 (const char *message) | |||
53 | strncat (tmp, &lookup[l & 0x3F], 1); | 53 | strncat (tmp, &lookup[l & 0x3F], 1); |
54 | } | 54 | } |
55 | 55 | ||
56 | if (length % 3) | 56 | if (2 == length % 3) |
57 | strncat (tmp, "==", 3 - length % 3); | 57 | strncat (tmp, "=", 1); |
58 | else if (1 == length % 3) | ||
59 | strncat (tmp, "==", 2); | ||
58 | 60 | ||
59 | return tmp; | 61 | return tmp; |
60 | } | 62 | } |