1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 12:39:11 +00:00

(svn r15626) -Fix [FS#2698]: UTF8 string handling could cause buffer overruns.

This commit is contained in:
rubidium
2009-03-06 01:23:25 +00:00
parent c3a7e6b693
commit 86ca408d46
8 changed files with 38 additions and 13 deletions

View File

@@ -237,6 +237,7 @@ void Packet::Recv_string(char *buffer, size_t size, bool allow_newlines)
{
PacketSize pos;
char *bufp = buffer;
const char *last = buffer + size - 1;
/* Don't allow reading from a closed socket */
if (cs->HasClientQuit()) return;
@@ -253,7 +254,7 @@ void Packet::Recv_string(char *buffer, size_t size, bool allow_newlines)
}
this->pos = pos;
str_validate(bufp, allow_newlines);
str_validate(bufp, last, allow_newlines);
}
#endif /* ENABLE_NETWORK */