aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/telnet_server.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 4fc71f3..8e79626 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -615,7 +615,11 @@ static void telnet_auto_complete(struct connection *connection)
while ((usr_cmd_pos < t_con->line_cursor) && isspace(t_con->line[usr_cmd_pos]))
usr_cmd_pos++;
- /* user command length */
+ /* check user command length */
+ if (t_con->line_cursor < usr_cmd_pos) {
+ telnet_bell(connection);
+ return;
+ }
size_t usr_cmd_len = t_con->line_cursor - usr_cmd_pos;
/* optimize multiple spaces in the user command,