From: bert hubert Date: Wed, 7 Feb 2018 09:05:33 +0000 (+0100) Subject: fix up salt for pbkdf2 X-Git-Tag: dnsdist-1.4.0-alpha1~27^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51d33cccbb1f4c247b87d89baa57b0e5b42e646e;p=pdns fix up salt for pbkdf2 --- diff --git a/pdns/ipcipher.cc b/pdns/ipcipher.cc index 963f11509..5d5230638 100644 --- a/pdns/ipcipher.cc +++ b/pdns/ipcipher.cc @@ -10,9 +10,10 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, */ std::string makeIPCipherKey(const std::string& password) { - static const char* salt="ipcryptipcrypt"; + static const char salt[]="ipcryptipcrypt"; unsigned char out[16]; - PKCS5_PBKDF2_HMAC_SHA1(password.c_str(), password.size(), (const unsigned char*)salt, sizeof(salt), 50000, sizeof(out), out); + + PKCS5_PBKDF2_HMAC_SHA1(password.c_str(), password.size(), (const unsigned char*)salt, sizeof(salt)-1, 50000, sizeof(out), out); return std::string((const char*)out, (const char*)out + sizeof(out)); }