From nobody Sat May 4 03:43:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1508893397909702.8977763699683; Tue, 24 Oct 2017 18:03:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 91BEE2034A7C5; Tue, 24 Oct 2017 17:59:31 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D42F620347143 for ; Tue, 24 Oct 2017 17:59:29 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2017 18:03:13 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by fmsmga006.fm.intel.com with ESMTP; 24 Oct 2017 18:03:12 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,430,1503385200"; d="scan'208";a="167188394" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Wed, 25 Oct 2017 09:03:08 +0800 Message-Id: <20171025010308.53424-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 Subject: [edk2] [PATCH] Shellpkg/editor: Fix a bug that may modifies Line[-1] X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaben Carsey , Hao A Wu MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The original code as below intend to set the character before last column to CHAR_NULL. Line[(LastCol % (ARRAY_SIZE (Line) - 1)) - 1] =3D CHAR_NULL; But when LastCol % (ARRAY_SIZE (Line) - 1)) equals to 0, Line[-1] is modified. We should change to code as below: Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] =3D CHAR_NULL; Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Jaben Carsey Cc: Hao A Wu Reviewed-by: Hao Wu Reviewed-by: Jaben Carsey --- .../Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c | = 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com= mandsLib.c index d26d08f95c..b45e9a33f3 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLi= b.c @@ -205,7 +205,7 @@ EditorClearLine ( // // if CHAR_NULL is still at position LastCol, it will cause first = line error // - Line[(LastCol % (ARRAY_SIZE (Line) - 1)) - 1] =3D CHAR_NULL; + Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] =3D CHAR_NULL; } else { Line[LastCol % (ARRAY_SIZE (Line) - 1)] =3D CHAR_NULL; } --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel