From: Maxim Mamontov Date: Sun, 25 Jan 2015 18:20:15 +0000 (+0200) Subject: Encrypt including the last \0. X-Git-Tag: 2.409~203 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/5706879913b24998078a1a99d4abd68480799891?hp=6811abd403c1726126361762feee7572069963e6 Encrypt including the last \0. --- diff --git a/stglibs/srvconf.lib/netunit.cpp b/stglibs/srvconf.lib/netunit.cpp index df0af7f2..61dc5c69 100644 --- a/stglibs/srvconf.lib/netunit.cpp +++ b/stglibs/srvconf.lib/netunit.cpp @@ -312,7 +312,8 @@ BLOWFISH_CTX ctx; InitContext(password.c_str(), PASSWD_LEN, &ctx); size_t length = strlen(text); char buffer[length + 9]; -EncryptString(buffer, text, length, &ctx); +memset(buffer, 0, sizeof(buffer)); +EncryptString(buffer, text, length + 1, &ctx); if (send(outerSocket, buffer, sizeof(buffer), 0) <= 0) { errorMsg = SEND_DATA_ERROR;