Mercurial > hg > openttd
changeset 7752:2657e8c82969 draft
(svn r11290) -Fix: obiwan in the assertion that checked for overflows when writing a packet, causing still correctly sized packets to cause assertions.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 18 Oct 2007 17:44:59 +0000 |
parents | d550704e7b05 |
children | 030026e5828d |
files | src/network/core/packet.cpp |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/core/packet.cpp +++ b/src/network/core/packet.cpp @@ -133,7 +133,8 @@ 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') {} }