diff --git a/Utils.cpp b/Utils.cpp index 298f4fc1..e63d2379 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -210,7 +210,7 @@ CString CUtils::SaltedHash(const CString& sPass, const CString& sSalt) { return CString(sPass + sSalt).MD5(); } -char* CUtils::GetPass(const CString& sPrompt) { +CString CUtils::GetPass(const CString& sPrompt) { PrintPrompt(sPrompt); return getpass(""); } diff --git a/Utils.h b/Utils.h index 07a338ef..3d3e5285 100644 --- a/Utils.h +++ b/Utils.h @@ -56,7 +56,7 @@ public: static CString GetSaltedHashPass(CString& sSalt); static CString GetSalt(); static CString SaltedHash(const CString& sPass, const CString& sSalt); - static char* GetPass(const CString& sPrompt); + static CString GetPass(const CString& sPrompt); static bool GetInput(const CString& sPrompt, CString& sRet, const CString& sDefault = "", const CString& sHint = ""); static bool GetBoolInput(const CString& sPrompt, bool bDefault); static bool GetBoolInput(const CString& sPrompt, bool *pbDefault = NULL); diff --git a/modules/away.cpp b/modules/away.cpp index b7996091..df824c35 100644 --- a/modules/away.cpp +++ b/modules/away.cpp @@ -71,12 +71,10 @@ public: { if (m_sPassword.empty()) { - char *pTmp = CUtils::GetPass("Enter Encryption Key for away.so: "); + CString sTmp = CUtils::GetPass("Enter Encryption Key for away.so: "); - if (pTmp) - m_sPassword = CBlowfish::MD5(pTmp); - - *pTmp = 0; + if (!sTmp.empty()) + m_sPassword = CBlowfish::MD5(sTmp); } if (!BootStrap()) diff --git a/modules/savebuff.cpp b/modules/savebuff.cpp index c172d937..bd4c0fe5 100644 --- a/modules/savebuff.cpp +++ b/modules/savebuff.cpp @@ -71,12 +71,10 @@ public: { if (m_sPassword.empty()) { - char *pTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so"); + CString sTmp = CUtils::GetPass("Enter Encryption Key for " + GetModName() + ".so"); - if (pTmp) - m_sPassword = CBlowfish::MD5(pTmp); - - *pTmp = 0; + if (!sTmp.empty()) + m_sPassword = CBlowfish::MD5(sTmp); } const vector& vChans = m_pUser->GetChans();