aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Auth
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-24 11:18:01 -0600
committermegamage <none@none>2008-12-24 11:18:01 -0600
commit184b82abccfff95b18bed81ded1b5a7e98d2dbd3 (patch)
tree4329c771076612bc55e52febfb5f323a2f21007e /src/shared/Auth
parent3cb4e7c716b11f357b3265257c51e7b6cc5c36f9 (diff)
Backed out changeset: ad4f100c0a9d
--HG-- branch : trunk
Diffstat (limited to 'src/shared/Auth')
-rw-r--r--src/shared/Auth/AuthCrypt.cpp3
-rw-r--r--src/shared/Auth/AuthCrypt.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/Auth/AuthCrypt.cpp b/src/shared/Auth/AuthCrypt.cpp
index 199e7192537..7941b33ed8c 100644
--- a/src/shared/Auth/AuthCrypt.cpp
+++ b/src/shared/Auth/AuthCrypt.cpp
@@ -50,8 +50,9 @@ void AuthCrypt::DecryptRecv(uint8 *data, size_t len)
void AuthCrypt::EncryptSend(uint8 *data, size_t len)
{
if (!_initialized) return;
+ if (len < CRYPTED_SEND_LEN) return;
- for (size_t t = 0; t < len; t++)
+ for (size_t t = 0; t < CRYPTED_SEND_LEN; t++)
{
_send_i %= _key.size();
uint8 x = (data[t] ^ _key[_send_i]) + _send_j;
diff --git a/src/shared/Auth/AuthCrypt.h b/src/shared/Auth/AuthCrypt.h
index 366cce5635f..f3a0cac40fa 100644
--- a/src/shared/Auth/AuthCrypt.h
+++ b/src/shared/Auth/AuthCrypt.h
@@ -32,6 +32,7 @@ class AuthCrypt
AuthCrypt();
~AuthCrypt();
+ const static size_t CRYPTED_SEND_LEN = 4;
const static size_t CRYPTED_RECV_LEN = 6;
void Init();