From c10f7db5760594b1166872746eb0769232ed7b77 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 22 Oct 2008 19:12:10 +0000 Subject: (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 --- src/querystring_gui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/querystring_gui.h') 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(size); } -- cgit v1.2.3-54-g00ecf