X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fserver%2Ftelnet_server.c;h=d41cfb53166e61fbb33c587c4c3ef9d24e939855;hb=b2b514be5bcca8b84736ed2abb8687477ade583c;hp=4fc71f384e26a693e9bc0dc5d538811da732065d;hpb=822097a351f8aef0036359bc3f4ad3972c1ddbe3;p=fw%2Fopenocd diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 4fc71f384..d41cfb531 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + /*************************************************************************** * Copyright (C) 2005 by Dominic Rath * * Dominic.Rath@gmx.de * @@ -7,19 +9,6 @@ * * * Copyright (C) 2008 by Spencer Oliver * * spen@spen-soft.co.uk * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -615,7 +604,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,