summaryrefslogtreecommitdiff
path: root/network_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-07 09:07:53 +0000
committertron <tron@openttd.org>2006-04-07 09:07:53 +0000
commit0099dc31f52135ea3b23daaa03a5ee51810538b8 (patch)
tree5b51a3d0a1e854a6a85712de15b3ef44a75c7e93 /network_gui.c
parent59f0e69521f54f5118ecacb7bee1388ba891bf87 (diff)
downloadopenttd-0099dc31f52135ea3b23daaa03a5ee51810538b8.tar.xz
(svn r4314) -Fix: a buffer overflow of the chat box introduced in r1263. Don't tell the Textbuf an arbitrary number as size of the string buffer, but the real lengthof() it
Diffstat (limited to 'network_gui.c')
-rw-r--r--network_gui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/network_gui.c b/network_gui.c
index f537a7ebb..adec0c004 100644
--- a/network_gui.c
+++ b/network_gui.c
@@ -1545,7 +1545,7 @@ static const WindowDesc _chat_window_desc = {
ChatWindowWndProc
};
-void ShowChatWindow(int maxlen)
+void ShowChatWindow(void)
{
Window *w;
@@ -1560,7 +1560,7 @@ void ShowChatWindow(int maxlen)
WP(w,querystr_d).wnd_class = WC_MAIN_TOOLBAR;
WP(w,querystr_d).wnd_num = 0;
WP(w,querystr_d).text.caret = false;
- WP(w,querystr_d).text.maxlength = maxlen;
+ WP(w,querystr_d).text.maxlength = lengthof(_edit_str_buf);
WP(w,querystr_d).text.maxwidth = w->widget[1].right - w->widget[1].left - 2; // widget[1] is the "text box"
WP(w,querystr_d).text.buf = _edit_str_buf;
UpdateTextBufferSize(&WP(w, querystr_d).text);