aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/telnet_server.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index f7b3f64..36b017c 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -352,10 +352,14 @@ static int telnet_history_print(struct connection *connection)
static void telnet_move_cursor(struct connection *connection, size_t pos)
{
- struct telnet_connection *tc;
+ struct telnet_connection *tc = connection->priv;
size_t tmp;
- tc = connection->priv;
+ if (pos == tc->line_cursor) /* nothing to do */
+ return;
+
+ if (pos > tc->line_size) /* out of bounds */
+ return;
if (pos < tc->line_cursor) {
tmp = tc->line_cursor - pos;