Unverified Commit 90e40f2c authored by Mathieu Stefani's avatar Mathieu Stefani Committed by GitHub

Merge pull request #140 from dgreatwood/avoidOverflowWhenBuffExactlyFull

Avoid overflow when buff exactly full
parents 24520ab6 c95010d1
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
} }
bool feed(const char* data, size_t len) { bool feed(const char* data, size_t len) {
if (size + len >= N) { if (size + len > N) {
return false; return false;
} }
......
...@@ -355,7 +355,7 @@ Transport::handleIncoming(const std::shared_ptr<Connection>& connection) { ...@@ -355,7 +355,7 @@ Transport::handleIncoming(const std::shared_ptr<Connection>& connection) {
else { else {
totalBytes += bytes; totalBytes += bytes;
if (totalBytes >= Const::MaxBuffer) { if (totalBytes > Const::MaxBuffer) {
std::cerr << "Too long packet" << std::endl; std::cerr << "Too long packet" << std::endl;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment