From 40501c2f5df002673237d1c8eead1cfd3111904c Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Wed, 25 Aug 2021 19:55:06 +0300 Subject: [PATCH] tlsauthentication.c: inelegant mute of compiler warning --- doc/examples/tlsauthentication.c | 6 ++++-- 1 file 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) strncat (tmp, &lookup[l & 0x3F], 1); } - if (length % 3) - strncat (tmp, "==", 3 - length % 3); + if (2 == length % 3) + strncat (tmp, "=", 1); + else if (1 == length % 3) + strncat (tmp, "==", 2); return tmp; }