summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-10-22 19:12:10 +0000
committersmatz <smatz@openttd.org>2008-10-22 19:12:10 +0000
commitbc1d994f6c3a1f81b2d5c71a4b656bab4e776d81 (patch)
tree43f6f4d436dced1e168f6a66c84f0027a6db24bd /src/network
parent852940b45b6ce895998e8455564d5a47bceddb5b (diff)
downloadopenttd-bc1d994f6c3a1f81b2d5c71a4b656bab4e776d81.tar.xz
(svn r14514) -Codechange: use 'size' instead of 'length' for querystring and textbuf, explicitly say it includes the terminating zero
-Fix: one couldn't rename things with too long default/automatic name -Fix: buffer overflow in console when too long (1024 bytes) command was entered
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_chat_gui.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 552095ec9..12cda3a43 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -374,11 +374,11 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
/* If we are completing at the begin of the line, skip the ': ' we added */
if (tb_buf == pre_buf) {
offset = 0;
- length = tb->length - 2;
+ length = (tb->size - 1) - 2;
} else {
/* Else, find the place we are completing at */
offset = strlen(pre_buf) + 1;
- length = tb->length - offset;
+ length = (tb->size - 1) - offset;
}
/* Compare if we have a match */