diff options
author | smatz <smatz@openttd.org> | 2008-10-22 19:12:10 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-10-22 19:12:10 +0000 |
commit | c10f7db5760594b1166872746eb0769232ed7b77 (patch) | |
tree | 43f6f4d436dced1e168f6a66c84f0027a6db24bd /src/querystring_gui.h | |
parent | 6bc0f0ef922c316d2a5de4f3ee9c70e4cc7131de (diff) | |
download | openttd-c10f7db5760594b1166872746eb0769232ed7b77.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/querystring_gui.h')
-rw-r--r-- | src/querystring_gui.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/querystring_gui.h b/src/querystring_gui.h index 05a25c42a..9c033200f 100644 --- a/src/querystring_gui.h +++ b/src/querystring_gui.h @@ -41,10 +41,11 @@ struct QueryString { struct QueryStringBaseWindow : public Window, public QueryString { char *edit_str_buf; char *orig_str_buf; - const uint16 edit_str_size; + const uint16 edit_str_size; ///< maximum length of string (in bytes), including terminating '\0' QueryStringBaseWindow(uint16 size, const WindowDesc *desc, WindowNumber window_number = 0) : Window(desc, window_number), edit_str_size(size) { + assert(size != 0); this->edit_str_buf = CallocT<char>(size); } |