From patchwork Fri Jul 3 09:34:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 50613 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB7C7214B3 for ; Fri, 3 Jul 2015 09:35:48 +0000 (UTC) Received: by wgfk9 with SMTP id k9sf28231284wgf.1 for ; Fri, 03 Jul 2015 02:35:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=2bPXoxaY41V73sF5FApmUsWK4CJeDJqzg9ksFVBpj6w=; b=g6L1El3/LoibvIdsWjXS32R4R+ikmxaj3ngdThUQcikWcWF/9a9ZqkF1sht+3CyMZs isJikGpncAZD3ra0i1eLLHSLO7s98IED/q5edGD+cqfy2TTYw1G6BCJmG0sueRq47y2/ vUkuvMOQz3rUUkH8lFlmjRW84CaALd/MKHv5JS2f2JKiUcJmrVZIOKyuyVwwX3ctugkX 5c1z0U2M2T2PUBlF0q+5hySoFIEjiUTmbfdnLcJvEAYbOzo3ynBWfA+gRa3rPDwD9cIz EedvwSAf4AN/+xw+2KQAg8j8N7PrN9Ol9SyEGfgvARfHzhDl52sICgIMUlanyyZkm3k0 DcqQ== X-Gm-Message-State: ALoCoQnlMvgq7rK2oEclzsN2zx73tXGRmaZW2eoNAd3ayE3UD90l3Q6Qd1/CDAcGTJ0R3hDogXaA X-Received: by 10.194.58.164 with SMTP id s4mr22257529wjq.3.1435916148310; Fri, 03 Jul 2015 02:35:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.101 with SMTP id z5ls426257laz.65.gmail; Fri, 03 Jul 2015 02:35:47 -0700 (PDT) X-Received: by 10.112.61.132 with SMTP id p4mr34769768lbr.48.1435916147821; Fri, 03 Jul 2015 02:35:47 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ec8si6762151lbb.68.2015.07.03.02.35.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jul 2015 02:35:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laar3 with SMTP id r3so78640017laa.0 for ; Fri, 03 Jul 2015 02:35:47 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr15131216lbb.29.1435916147711; Fri, 03 Jul 2015 02:35:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1043195lbb; Fri, 3 Jul 2015 02:35:46 -0700 (PDT) X-Received: by 10.107.46.2 with SMTP id i2mr51895393ioo.18.1435916144407; Fri, 03 Jul 2015 02:35:44 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id hu6si4846125igb.44.2015.07.03.02.35.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Jul 2015 02:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZAxNd-0005Tf-5L; Fri, 03 Jul 2015 09:35:33 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZAxNc-0005TG-DC for edk2-devel@lists.sourceforge.net; Fri, 03 Jul 2015 09:35:32 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.220.43 as permitted sender) client-ip=209.85.220.43; envelope-from=heyi.guo@linaro.org; helo=mail-pa0-f43.google.com; Received: from mail-pa0-f43.google.com ([209.85.220.43]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1ZAxNb-0003Y6-KE for edk2-devel@lists.sourceforge.net; Fri, 03 Jul 2015 09:35:32 +0000 Received: by paceq1 with SMTP id eq1so54821283pac.3 for ; Fri, 03 Jul 2015 02:35:26 -0700 (PDT) X-Received: by 10.70.23.196 with SMTP id o4mr48383635pdf.164.1435916125922; Fri, 03 Jul 2015 02:35:25 -0700 (PDT) Received: from localhost.localdomain ([180.150.148.224]) by mx.google.com with ESMTPSA id sl9sm8437289pac.41.2015.07.03.02.35.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jul 2015 02:35:25 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.sourceforge.net Date: Fri, 3 Jul 2015 17:34:41 +0800 Message-Id: <1435916081-27645-3-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1435916081-27645-1-git-send-email-heyi.guo@linaro.org> References: <1435916081-27645-1-git-send-email-heyi.guo@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1ZAxNb-0003Y6-KE Subject: [edk2] [PATCH 2/2] ShellPkg: Fix bug introduced by r17730 X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: heyi.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 CurrentFilePattern is only part of FilePattern and will be less than or equal to FilePattern. If we use StrCpyS to replace StrnCpy, it will cause assert when FilePattern is longer. The bug can be replayed when we cd to one directory and run ls command. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo Reviewed-by: Ard Biesheuvel --- ShellPkg/Application/Shell/ShellProtocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 249e1e1..6a24852 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -2220,7 +2220,7 @@ ShellSearchHandle( CurrentFilePattern = AllocateZeroPool((NextFilePatternStart-FilePattern+1)*sizeof(CHAR16)); ASSERT(CurrentFilePattern != NULL); - StrCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern); + StrnCpyS(CurrentFilePattern, NextFilePatternStart-FilePattern+1, FilePattern, NextFilePatternStart-FilePattern); if (CurrentFilePattern[0] == CHAR_NULL &&NextFilePatternStart[0] == CHAR_NULL