From patchwork Thu Jan 20 15:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 533540 Delivered-To: patch@linaro.org Received: by 2002:ad5:5d50:0:0:0:0:0 with SMTP id x16csp1675684imu; Thu, 20 Jan 2022 07:29:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzi3tSMipcwPluyofqdJOFLGzoAFyHd+a4wFFjH01n1WQyc9VVVwJw60X3YZQiywo38riEE X-Received: by 2002:a17:907:6da6:: with SMTP id sb38mr14967368ejc.705.1642692583047; Thu, 20 Jan 2022 07:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642692583; cv=none; d=google.com; s=arc-20160816; b=qKRCEWdEBjJIssv5RtJ3hgZDNc3KBANJExg3eirvBEfVKqr6LHxwGNM5bm1mk49E76 E2p/oAWej+RzbUMi9QZ8+fPxM7KsJIhcQyTgeAMH61A4dw3AnIlAD/E9lv0Ycq50Q/D3 QviGakBQQ6OvaQWt6LPhkCPY9KyR3NG8YpIlLI6XN0XHX6ABe50Gx96w5iz+hQ79Jqwl Ob4e7hy7m12Jx3tvJkLLil11mPWAbdOluOWF9/CuB9MOVV4V9kOO0Gpu+JMnnsUaFcRp Xgi9etURxBxuhcI5FZMi9Z9Dsr28IbU9T6xcjMPH6bAAF6ZrNWNN0YOXSe+TvLd7bBhF ypeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Z2ROnf8FiP3NdigMZdG7gXUWT9ksrzqvxWkcZavbpuA=; b=j0BEGQCgs/P0khL4p59Bg6iVx+uKUIPcJHjlJQUig1lAtPfPWKmtB0uCqdk8ttJ2Ew HGwZ7xeC/awfzmQpqXJpuHtP+cAC1SILRSxo+AuxtnPrdKAzwPluF/yXetu0GZK0kqgv KlWYfku3CJ/UruQ+cC8dfJZ2pfinVGxK2cgLc1RcXtTqK/qMcOmtvzxMFFmEovE7Y/oU E6q1xZDT+82WFWEJ6ELuyGPlJZtrkZ1an7mWySl/pE72zRMzvwl9A20xB+2rvZho/NIH 1E2MozbdmJx/0tKGm4kwTRrAmxASnZs0ZAvXteIBL2be5+mAl6im3BmBEYyeKa037xiu yy8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLxu6Uk3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 8si1921594ejd.410.2022.01.20.07.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 07:29:43 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLxu6Uk3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 65386838AC; Thu, 20 Jan 2022 16:29:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="sLxu6Uk3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 106ED838A7; Thu, 20 Jan 2022 16:29:39 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (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 55A24838A6 for ; Thu, 20 Jan 2022 16:29:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pj1-x102b.google.com with SMTP id d15-20020a17090a110f00b001b4e7d27474so6092418pja.2 for ; Thu, 20 Jan 2022 07:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=Z2ROnf8FiP3NdigMZdG7gXUWT9ksrzqvxWkcZavbpuA=; b=sLxu6Uk3jwlI7iiHs6YkaHHeaWUMA3cQkVtUROyX9R9tHffgXS7u5DnHgX+n71Kv26 /kP9Ar6JET4Z7IsiWuBLEc7qeUXLTRmTUKRRbsOQr8KNy+AjYcwn2952JtaO9yDD02OG XrANRfgiSA8W+Tyb/QrVipwPu2VWG7J0Vb6q9+yIB6CvYMHlmhyz7ZvUXgvPqsDdm4FW xUe5ilC/i6NSzNyL5UR2jJSQxYBwFdart5W8Sm4Ag2bmMYf4MafOcJPGsNINNSa54pqm QtvRJgY3APbAf+3cX+AQGRGANAXZ1MuOCYLndBoZbKpO1+Mw7L33H5TpAeLNka6q/PkA hYHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=Z2ROnf8FiP3NdigMZdG7gXUWT9ksrzqvxWkcZavbpuA=; b=DM0/9rSvXJYA2XSBHilkYdcHopZOJkz/NRx3slGz87XqEHwGQnFkuIxdAFT+spLKiC BSBJIgW52uV4yLFCAD775F+L+0Q21bqmIcWs1n/wi/H5/mgURt8HM6tnA+g3gXZ8dwwe pNR8OpNUrVQlTKT9iqnyib6iJ6SY6nc3uGlRBbYq7R7iEX/OgA4nklpgJvdcHkOKPGkp Byp2tab3Kuz1agljNZZW2eF7CfBu4cZ7f8+AUNFL7ZMNbc1UEXuos+zPnLNfsUaRyiFa yOWbxOkYzBJUTM3lZ7ALaVBKAUA7cOqb/kLKXd8ShCB4E68zd6VqoEr/7tslmg9obUve fvCg== X-Gm-Message-State: AOAM533hPWHMoffBSfBkmJQrwrfyJkPJfQ6un2+aXXTeHMqktZ7F+/Jq MOLW68IOp7dlihmP282Zqxd9opYltsrc5g== X-Received: by 2002:a17:90b:3e8e:: with SMTP id rj14mr11476505pjb.179.1642692574449; Thu, 20 Jan 2022 07:29:34 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id c17sm4015405pfc.171.2022.01.20.07.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 07:29:34 -0800 (PST) From: Masami Hiramatsu To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: [RFC PATCH 01/14] DFU: Do not copy the entity name over the buffer size Date: Fri, 21 Jan 2022 00:29:30 +0900 Message-Id: <164269256989.39378.10399862613876371846.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164269255955.39378.260729958623102750.stgit@localhost> References: <164269255955.39378.260729958623102750.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.2 at phobos.denx.de X-Virus-Status: Clean Use strlcpy() instead of strcpy() to prevent copying the entity name over the name buffer size. Signed-off-by: Masami Hiramatsu --- drivers/dfu/dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index af3975925a..66c41b5e76 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -503,7 +503,7 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, debug("%s: %s interface: %s dev: %s\n", __func__, s, interface, devstr); st = strsep(&s, " "); - strcpy(dfu->name, st); + strlcpy(dfu->name, st, DFU_NAME_SIZE); dfu->alt = alt; dfu->max_buf_size = 0;