summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/enc_sha1.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/modules/core/enc_sha1.cpp b/modules/core/enc_sha1.cpp
index a5235c594..4047f539a 100644
--- a/modules/core/enc_sha1.cpp
+++ b/modules/core/enc_sha1.cpp
@@ -138,7 +138,7 @@ void SHA1Update(SHA1_CTX *context, const unsigned char *data, uint32 len)
/* Add padding and return the message digest. */
-void SHA1Final(unsigned char digest[20], SHA1_CTX *context)
+void SHA1Final(unsigned char digest[21], SHA1_CTX *context)
{
uint32 i;
unsigned char finalcount[8];
@@ -182,12 +182,10 @@ class ESHA1 : public Module
EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest)
{
SHA1_CTX context;
- char *digest = new char[Config.PassLen];
+ char digest[21] = "";
Anope::string buf = "sha1:";
Anope::string cpass;
- memset(digest, 0, 32);
-
SHA1Init(&context);
SHA1Update(&context, reinterpret_cast<const unsigned char *>(src.c_str()), src.length());
SHA1Final(reinterpret_cast<unsigned char *>(digest), &context);
@@ -196,7 +194,6 @@ class ESHA1 : public Module
buf += cpass;
Alog(LOG_DEBUG_2) << "(enc_sha1) hashed password from [" << src << "] to [" << buf << "]";
dest = buf;
- delete [] digest;
return EVENT_ALLOW;
}