summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-09 10:17:28 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-09 10:17:28 +0000
commit621de565e15f9301b1e735b4c758fb805da57d86 (patch)
tree884bd1466f33f2719c8f8935d053c068fdaa4b05
parente58161f80d25552e4b6f2d8ca33176d006ac33e9 (diff)
Apply brain's patch for binary safety of hash providers, and remove rehash from windows project (manually applied that due to linefeed shit)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9441 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_hash.h4
-rw-r--r--src/modules/m_md5.cpp6
-rw-r--r--src/modules/m_sha256.cpp2
-rw-r--r--win/m_spanningtreeVC80.vcproj4
4 files changed, 6 insertions, 10 deletions
diff --git a/src/modules/m_hash.h b/src/modules/m_hash.h
index 6351cf04f..5686169dd 100644
--- a/src/modules/m_hash.h
+++ b/src/modules/m_hash.h
@@ -54,9 +54,9 @@ class HashRequest : public Request
}
/** Get data to be hashed */
- const char* GetHashData()
+ std::string& GetHashData()
{
- return tohash.c_str();
+ return tohash;
}
/** Get keys (IVs) to be used */
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp
index 402007177..6096f9afa 100644
--- a/src/modules/m_md5.cpp
+++ b/src/modules/m_md5.cpp
@@ -245,11 +245,11 @@ class ModuleMD5 : public Module
}
- void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey)
+ void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey, size_t srclen)
{
unsigned char bytes[16];
- MyMD5((char*)bytes, (void*)src, strlen(src), ikey);
+ MyMD5((char*)bytes, (void*)src, srclen, ikey);
for (int i = 0; i < 16; i++)
{
@@ -293,7 +293,7 @@ class ModuleMD5 : public Module
else if (strcmp("SUM", request->GetId()) == 0)
{
static char data[MAXBUF];
- GenHash((const char*)MD5->GetHashData(), data, chars ? chars : "0123456789abcdef", key);
+ GenHash(MD5->GetHashData().data(), data, chars ? chars : "0123456789abcdef", key, MD5->GetHashData().length());
return data;
}
else if (strcmp("NAME", request->GetId()) == 0)
diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp
index 70727b301..aee1cb12a 100644
--- a/src/modules/m_sha256.cpp
+++ b/src/modules/m_sha256.cpp
@@ -285,7 +285,7 @@ class ModuleSHA256 : public Module
else if (strcmp("SUM", request->GetId()) == 0)
{
static char data[MAXBUF];
- SHA256((const char*)SHA->GetHashData(), data, strlen(SHA->GetHashData()), chars ? chars : "0123456789abcdef", key);
+ SHA256((const char*)SHA->GetHashData().data(), data, SHA->GetHashData().length(), chars ? chars : "0123456789abcdef", key);
return data;
}
else if (strcmp("NAME", request->GetId()) == 0)
diff --git a/win/m_spanningtreeVC80.vcproj b/win/m_spanningtreeVC80.vcproj
index 452764ede..db0552de7 100644
--- a/win/m_spanningtreeVC80.vcproj
+++ b/win/m_spanningtreeVC80.vcproj
@@ -518,10 +518,6 @@
>
</File>
<File
- RelativePath="..\src\modules\m_spanningtree\rehash.cpp"
- >
- </File>
- <File
RelativePath="..\src\modules\m_spanningtree\resolvers.cpp"
>
</File>