From patchwork Mon Jan 31 02:52:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 538473 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1405611imr; Sun, 30 Jan 2022 18:52:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzavicVprj6llMvCbGsF9FBJiuKhbMBELcgQA53/FOQDkbZbod9IKDHlHSexKICkeXCZh41 X-Received: by 2002:a05:6402:22bb:: with SMTP id cx27mr18261779edb.304.1643597553512; Sun, 30 Jan 2022 18:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643597553; cv=none; d=google.com; s=arc-20160816; b=0MNiXpVqFFAnL4fOhFUe3Z2Zuysi1uKipTCIr2UgWPdwCZwSnXsmb41nfG2SPYVmw4 zdJiS1QeLN4NzlKKyUSFK6crERSuGUWVCLkTOcZyPWEE74eh5Cx5Tbw+A9yK94Hp+BNP DFW6Pri82FzOySK8CbVyEHWgcudiI/AyS4IFa69n8oHi60kYDTMOrG5vScPNNn/lZYfR vRiXpL+TDLgyOTliAkizK3Ghh6d6IpsRcGcx0Q270WuTQlqmZ9tEg73dd17rbMAeeKrg a9uaHPeapUPxUxkvIC7Sa8glf2GfNhdWrgCd6znMYGXnHb8UqDqTpeRXzMd/2tCiKM5H YovA== 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=IrQ3WERdURI3JYORg67beu+6kiNHSMcvzCotDMeJS5tLApDvTMxxf8NSFektAgt07V ATZJG0Wtzm6tzmw2oZJlNsimpWy8rQVeDzDAs4aF96kFzXvuzXYVuI6UHOp4cJVmbi2v /Unw3KsclrfjFhYvZ4hPTnGorxctczu1FrqYMhIpVy+77jY5Ts9kAfPgQjJcZoT54IrX /0N8thFZ/jzYdNtZ8b88tIG8l6I2K+ZmT16+cWW5n+ME+UIxsrQbqC0epyl4x8E8bTT2 kEOvmtzqM2YHfH1ZxC9Yf09cPpjjEzlKX/Oe0SkldZRfC9dSsBdiomSsa35UElzmj5Ju 20lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fr6o/1Z3"; 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 9si7301667ejd.50.2022.01.30.18.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 18:52:33 -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="Fr6o/1Z3"; 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 7E5D7835BA; Mon, 31 Jan 2022 03:52:29 +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="Fr6o/1Z3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B1ED8339D; Mon, 31 Jan 2022 03:52:28 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (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 3D2F58339D for ; Mon, 31 Jan 2022 03:52:25 +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-pg1-x52b.google.com with SMTP id e16so11001689pgn.4 for ; Sun, 30 Jan 2022 18:52:25 -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=Fr6o/1Z3bwyntT3KOgMQZTx3DToWbSxCJBmvzY2vfBCW4zu1nZwHi3oCJgTXeIoacT 0jj8Ve3+V8hcFNQFoEDuvhzuRYp50OS2Fo+W/ucu1DM/frFZ20sltkjf+ad6OfE2+Ar3 jSepq/zSHHHm0BWjpICYBNgvn/63KZmOJZ+HoVzKmEBS/oaBkNnN103rWPpWiYonoHh8 WN2UxAfDxxvCiIrSdmZ0mKXzj2GUy1gPnFzmlhWWbgXNe+qMvl7l4ZcXwfGCfE4BDmUE 5VxOfZH2t8gdv3Km3mmlUFd+OkJfuUW1ETwf+H9D8rliMaGACknRu5AgWIHjrVo4UKJH q9yA== 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=prQnjTzxNzjetZeBtM72xzQ7WzuP/elCiBMtQnboNLTb3KGig9qBwLJ88uhnvCPAYU mgTMRVUDCPZ6u0vR1UUAa0WRnkYU63+9UIwkVvb9R7Slkl39ShQ+0l5GvQ8KvikUfko6 yX47j4UcRD93HhF50HrgyMB8bhzmH4C4qgtaLRdqRiharfaRvIIPZ38GwExU9AgO+ZPn D7wqtu+mpfb6bkt/L5SE4It+ab9NkDvFaOyLYE0xWVTP5fwyEGuD0kgU4pXo4MbLJb0S Qj+IA3meO4p+D2oawnet4idR+TIBkGOtBZr/9yXE7ozhX7t7giOyGmWbBkTQESqv1jca zzzg== X-Gm-Message-State: AOAM531XnsiZV3OvxxCQvuVvcdtbhPHW7pb2V9GfjzvBq77IQoG1QVTw FznUn9fqu1LR5VEAREz+JpX0DA== X-Received: by 2002:a63:e250:: with SMTP id y16mr14927001pgj.147.1643597543701; Sun, 30 Jan 2022 18:52:23 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id s37sm12089955pfg.144.2022.01.30.18.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 18:52:23 -0800 (PST) From: Masami Hiramatsu To: Tom Rini , Lukasz Majewski Cc: u-boot@lists.denx.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, jaswinder.singh@linaro.org Subject: [PATCH v2 1/5] DFU: Do not copy the entity name over the buffer size Date: Mon, 31 Jan 2022 11:52:20 +0900 Message-Id: <164359754070.280839.249007223441412046.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164359753172.280839.8310577813724924540.stgit@localhost> References: <164359753172.280839.8310577813724924540.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.5 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;