From 51d33cccbb1f4c247b87d89baa57b0e5b42e646e Mon Sep 17 00:00:00 2001 From: bert hubert Date: Wed, 7 Feb 2018 10:05:33 +0100 Subject: [PATCH] fix up salt for pbkdf2 --- pdns/ipcipher.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); } -- 2.40.0