diff options
author | Andreas Nilsson <andreas.nilsson@10gen.com> | 2014-04-14 11:41:49 -0400 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2014-04-15 18:44:28 -0400 |
commit | 5636fd6504b1b5a649468e62f48b7bae00f24b0f (patch) | |
tree | 72883df0eda91abe11bff95560eedacb92475210 | |
parent | 1b7b02db89e8a574cb2f5bff717090a8719d4fb9 (diff) | |
download | mongo-5636fd6504b1b5a649468e62f48b7bae00f24b0f.tar.gz |
SERVER-13561 Improve wire API message validation
(cherry picked from commit 1490a4f30f7356c9b47cab77f17937f207f09551)
-rw-r--r-- | src/mongo/util/net/message.h | 2 | ||||
-rw-r--r-- | src/mongo/util/net/message_port.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/util/net/message.h b/src/mongo/util/net/message.h index aa30bd85cfc..afac99035d2 100644 --- a/src/mongo/util/net/message.h +++ b/src/mongo/util/net/message.h @@ -29,7 +29,7 @@ namespace mongo { /** * Maximum accepted message size on the wire protocol. */ - const int MaxMessageSizeBytes = 48 * 1000 * 1000; + const size_t MaxMessageSizeBytes = 48 * 1000 * 1000; class Message; class MessagingPort; diff --git a/src/mongo/util/net/message_port.cpp b/src/mongo/util/net/message_port.cpp index 889d36a3c11..1a21bfb38d9 100644 --- a/src/mongo/util/net/message_port.cpp +++ b/src/mongo/util/net/message_port.cpp @@ -202,7 +202,8 @@ again: sslGlobalParams.sslMode.load() != SSLGlobalParams::SSLMode_requireSSL); #endif // MONGO_SSL } - else if ( len < static_cast<int>(sizeof(MSGHEADER)) || len > MaxMessageSizeBytes ) { + if ( static_cast<size_t>(len) < sizeof(MSGHEADER) || + static_cast<size_t>(len) > MaxMessageSizeBytes ) { LOG(0) << "recv(): message len " << len << " is invalid. " << "Min " << sizeof(MSGHEADER) << " Max: " << MaxMessageSizeBytes << endl; return false; |