From patchwork Sun Nov 22 04:58:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Bennett X-Patchwork-Id: 1404472 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=workware.net.au Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=workware-net-au.20150623.gappssmtp.com header.i=@workware-net-au.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=KZL16tHH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cf8Bg2XLWz9sSf for ; Sun, 22 Nov 2020 23:05:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3BDDA82564; Sun, 22 Nov 2020 13:05:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=workware.net.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=workware-net-au.20150623.gappssmtp.com header.i=@workware-net-au.20150623.gappssmtp.com header.b="KZL16tHH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 91194821A4; Sun, 22 Nov 2020 05:59:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3206B821A4 for ; Sun, 22 Nov 2020 05:58:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=workware.net.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=steveb@workware.net.au Received: by mail-pf1-x442.google.com with SMTP id 10so11801162pfp.5 for ; Sat, 21 Nov 2020 20:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=workware-net-au.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=A0dU1lehXVeEZvcM1zk2Sjx3Mz3TMSkTTzkM5LSxj0w=; b=KZL16tHHD0BxxL/kM+pj/3sedFbrkxSPduR3ZpAtWO1apQu5pNcNREN7l9iMB74E7d Pr/RuwKS5Mon0aL2QsJZIXwv+NUy/9ZCXOF/bFYUiS+hB0bHmq4QHsCDR44OOvm1krom 2+z53lmaZqupYxohB88U9oed+eiHB4sgeZle0i/awK5v13MhVqC02HmYBFu2dyZ2KRuJ j/v5kEMiOhiGzQlYGWCxnyBYDh3NWGSxj6R6N//1uDuNKcbK/D3aGDnU5srNeWCi3tyD GsH/FWcQ0Wh3SKQaevoRHmHVvcP4XWap/CILUNZ4189irm3eMKChG++/tan+Kh6y2JTe FAFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=A0dU1lehXVeEZvcM1zk2Sjx3Mz3TMSkTTzkM5LSxj0w=; b=diG7mhm3iyJqEH2OwSHVJOnAPsxTs0hekdwMDoAHkd34tZ/QdPr6l0BpApnwxWXvvf DHP4BHeSi1bXbN/lgEzVz/Dy4atX3QCGzW4YyZOe1rkCXz/FoxcOK8naWvh2Te/7iPnP m3CR+fSCrdAC8P4RtQiAVY5QBtPMP0h++san232zX+h3RT2vRJNpLluCvHOQiTqNrba0 VuxyH7rQf59zXRFBHruX+lp89yWMEaXYE4S5wi2o2BeVefnjZaIhXxc9S+hB8gcta9Jw F5BOgGGbYryFnwBS2ewgbwCGsATbVdG1Xz5fo2Cy56EpPhCrnP36FXb9jHMG7qtjiZE/ WmMw== X-Gm-Message-State: AOAM5313s4OZW81vl3cZiKE6m1Zl5HME/NnnDVqwNKlxErwVaYt5bCGN Smd6jO3ZiH1uG6FUvS+jYsrgX/lidbjL3w== X-Google-Smtp-Source: ABdhPJw1YndkZNWxAnNFchR8sBESeizz4U1F3mJkF5sR45TPqDDCr8/mhyZwsImeIpjkR4/yoX1kaw== X-Received: by 2002:a17:90a:6a0e:: with SMTP id t14mr17926183pjj.95.1606021137826; Sat, 21 Nov 2020 20:58:57 -0800 (PST) Received: from stevebmac.bennettfamily.id.au (117-20-68-186.751444.bne.nbn.aussiebb.net. [117.20.68.186]) by smtp.gmail.com with ESMTPSA id c22sm8106267pfo.211.2020.11.21.20.58.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Nov 2020 20:58:57 -0800 (PST) From: Steve Bennett To: u-boot@lists.denx.de Cc: Steve Bennett Subject: [PATCH] cli_readline: Only insert printable chars Date: Sun, 22 Nov 2020 14:58:45 +1000 Message-Id: <20201122045845.62456-1-steveb@workware.net.au> X-Mailer: git-send-email 2.24.2 (Apple Git-127) MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 22 Nov 2020 13:05:36 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean There should be no need to insert non-printable characters and this prevents line editing getting confused. Signed-off-by: Steve Bennett --- common/cli_readline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/cli_readline.c b/common/cli_readline.c index 47b876285c..5c158d03b4 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -493,8 +493,10 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, } #endif default: - cread_add_char(ichar, insert, &num, &eol_num, buf, - *len); + if (ichar >= ' ' && ichar <= '~') { + cread_add_char(ichar, insert, &num, &eol_num, + buf, *len); + } break; } }