summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-18 17:44:59 +0000
committerrubidium <rubidium@openttd.org>2007-10-18 17:44:59 +0000
commit8795050ff75fc9594f02e45945b28c90bb8db642 (patch)
treeb65a1bb099d0cd6f74762d4c2704a96edf1f3dda /src
parent405489d06f8df3fc704f5f6bd1d32568c27a0e6d (diff)
downloadopenttd-8795050ff75fc9594f02e45945b28c90bb8db642.tar.xz
(svn r11290) -Fix: obiwan in the assertion that checked for overflows when writing a packet, causing still correctly sized packets to cause assertions.
Diffstat (limited to 'src')
-rw-r--r--src/network/core/packet.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/core/packet.cpp b/src/network/core/packet.cpp
index 8d85e9ad5..0da9b1a07 100644
--- a/src/network/core/packet.cpp
+++ b/src/network/core/packet.cpp
@@ -133,7 +133,8 @@ void Packet::Send_uint64(uint64 data)
void Packet::Send_string(const char* data)
{
assert(data != NULL);
- assert(this->size < sizeof(this->buffer) - strlen(data) - 1);
+ /* The <= *is* valid due to the fact that we are comparing sizes and not the index. */
+ assert(this->size + strlen(data) + 1 <= sizeof(this->buffer));
while ((this->buffer[this->size++] = *data++) != '\0') {}
}