From patchwork Fri Feb 13 06:33:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dileep Katta X-Patchwork-Id: 44670 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31D402153D for ; Fri, 13 Feb 2015 06:34:33 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf9441597lbi.0 for ; Thu, 12 Feb 2015 22:34:31 -0800 (PST) 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:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=HchxJiTMsjUyg154BhsdTFxIDvOpO5CyG5paGGxopTc=; b=NJv09JSYbsbVLDhMcYFdGoRzbBHUj7uZQLdnuFhVGzgmI8n84uFCJzHXHuVVGITd8B oS+pdqDFxm5i4XuKYQmdUpuPT5jHjum2GeD0Yp5Y1xmiK6rcYG37FzOhQiwAvGKaBzRq uWBAZb+I1UFM48oKm/6TkeCRVMON4BSR4KS95TWpAFlnI6tkhj3IQmDOUuzR61rWL/um 32ykYe3UUJ6d9aZiTA8HKzHhjHBwbpf2umSSuNvlSUyngb5jcsIyk2/d1sRqQUOoc5Ij QZvXOebalk+C0aIBmLrPDRrfVCjJXNwRvtfychNmporalnwXXNjvlwZU8R0UPFQVSSxX rV3w== X-Gm-Message-State: ALoCoQn+918jMdYa6aAKTxchVjHdJ7Ej2nuGBrxzMhqtGZosmeeI6ssTqZISzR+2sS4FgQGA23gG X-Received: by 10.180.212.76 with SMTP id ni12mr1071845wic.0.1423809271705; Thu, 12 Feb 2015 22:34:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.201 with SMTP id e9ls244584lag.67.gmail; Thu, 12 Feb 2015 22:34:31 -0800 (PST) X-Received: by 10.152.161.232 with SMTP id xv8mr6507369lab.15.1423809271283; Thu, 12 Feb 2015 22:34:31 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id z5si859519lae.111.2015.02.12.22.34.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 22:34:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z11so13738687lbi.8 for ; Thu, 12 Feb 2015 22:34:31 -0800 (PST) X-Received: by 10.112.161.34 with SMTP id xp2mr6369020lbb.73.1423809271172; Thu, 12 Feb 2015 22:34:31 -0800 (PST) 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.35.133 with SMTP id h5csp882102lbj; Thu, 12 Feb 2015 22:34:30 -0800 (PST) X-Received: by 10.180.206.98 with SMTP id ln2mr2834297wic.94.1423809270635; Thu, 12 Feb 2015 22:34:30 -0800 (PST) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id bh10si2145043wib.31.2015.02.12.22.34.29; Thu, 12 Feb 2015 22:34:30 -0800 (PST) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8E32AA74AA; Fri, 13 Feb 2015 07:34:29 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pJ_iGfqC78LF; Fri, 13 Feb 2015 07:34:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B621CA7464; Fri, 13 Feb 2015 07:34:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27FF0A7443 for ; Fri, 13 Feb 2015 07:34:27 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20c86P563UlN for ; Fri, 13 Feb 2015 07:34:27 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by theia.denx.de (Postfix) with ESMTPS id A2E38A7442 for ; Fri, 13 Feb 2015 07:34:23 +0100 (CET) Received: by pdbfp1 with SMTP id fp1so13113398pdb.5 for ; Thu, 12 Feb 2015 22:34:22 -0800 (PST) X-Received: by 10.68.197.133 with SMTP id iu5mr12540988pbc.131.1423809262671; Thu, 12 Feb 2015 22:34:22 -0800 (PST) Received: from localhost.localdomain ([210.177.145.249]) by mx.google.com with ESMTPSA id xx7sm5653479pab.21.2015.02.12.22.34.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Feb 2015 22:34:22 -0800 (PST) From: Dileep Katta To: u-boot@lists.denx.de, robherring2@gmail.com, trini@ti.com, rob.herring@linaro.org, srae@broadcom.com, l.majewski@samsung.com, angelabaker@ti.com Date: Fri, 13 Feb 2015 14:33:42 +0800 Message-Id: <1423809223-24219-2-git-send-email-dileep.katta@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1423809223-24219-1-git-send-email-dileep.katta@linaro.org> References: <1423809223-24219-1-git-send-email-dileep.katta@linaro.org> Cc: Dileep Katta Subject: [U-Boot] [PATCH v1 2/3] fastboot: Correct fastboot_fail and fastboot_okay strings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dileep.katta@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.217.177 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 If the string is copied without NULL termination using strncpy(), then strncat() on the next line, may concatenate the string after some stale (or random) data, if the response string was not zero-initialized. Signed-off-by: Dileep Katta --- common/fb_mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/fb_mmc.c b/common/fb_mmc.c index 3911989..73055cc 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -23,13 +23,13 @@ static char *response_str; void fastboot_fail(const char *s) { - strncpy(response_str, "FAIL", 4); + strncpy(response_str, "FAIL\0", 5); strncat(response_str, s, RESPONSE_LEN - 4 - 1); } void fastboot_okay(const char *s) { - strncpy(response_str, "OKAY", 4); + strncpy(response_str, "OKAY\0", 5); strncat(response_str, s, RESPONSE_LEN - 4 - 1); }