diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-08-01 12:21:42 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-08-01 12:21:42 -0400 |
commit | 084766069cdf24b69e1f146db4d44a24b617e7de (patch) | |
tree | c1ff0fd43ed68a7ee55d4ad953dc45bc8310362b /modules | |
parent | 1175ef320e25919746cafda6c8aaa57c5adc1860 (diff) | |
parent | bfd94136c62b20f0a8e15d22815ef3a6e6438d49 (diff) |
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'modules')
-rw-r--r-- | modules/core/enc_sha256.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/core/enc_sha256.cpp b/modules/core/enc_sha256.cpp index b0369ee21..15dfce120 100644 --- a/modules/core/enc_sha256.cpp +++ b/modules/core/enc_sha256.cpp @@ -138,6 +138,7 @@ class ESHA256 : public Module Anope::string buf2; for (int i = 0; i < 8; ++i) UNPACK32(iv[i], reinterpret_cast<unsigned char *>(&buf[i << 2])); + buf[32] = '\0'; b64_encode(buf, buf2); return buf2; } @@ -262,7 +263,7 @@ class ESHA256 : public Module EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { - char digest[SHA256_DIGEST_SIZE]; + char digest[SHA256_DIGEST_SIZE+1]; Anope::string cpass; SHA256Context ctx; std::stringstream buf; @@ -275,7 +276,7 @@ class ESHA256 : public Module SHA256Init(&ctx); SHA256Update(&ctx, reinterpret_cast<const unsigned char *>(src.c_str()), src.length()); SHA256Final(&ctx, reinterpret_cast<unsigned char *>(digest)); - + digest[SHA256_DIGEST_SIZE] = '\0'; b64_encode(digest, cpass); buf << "sha256:" << cpass << ":" << GetIVString(); Alog(LOG_DEBUG_2) << "(enc_sha256) hashed password from [" << src << "] to [" << buf.str() << " ]"; |