From patchwork Mon Dec 6 05:44:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 520957 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4223909imb; Sun, 5 Dec 2021 21:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvHAZyeHQa9CrTiTDcbaikjkgJckLcoT+iuZzr++oJZnjjU1QCrAZLE74dhYim2EEsMh8x X-Received: by 2002:a17:906:489b:: with SMTP id v27mr42051418ejq.567.1638769489984; Sun, 05 Dec 2021 21:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638769489; cv=none; d=google.com; s=arc-20160816; b=OBy2X1CXxhD7lZpnQACmSLKY+/E3snvnLoICpcBfQleBfMViuIzTl54gTEIMq6NCfS UATe0WDjbIV+aUeh5fZBmXuW1AMLCq3BK6Z8kZpdboEKMEp/xuOZSGcpK6Gwfs5oxgj+ IdDXkt70Babf33RcH5URmQHKlA8a1f6Ydo3XaPQCbd24skk/quqVxUglL0lkWW134T20 0vM+7he6nAkDXRn0IWtoztp1O7yx31mofJUxKNJK7HN0+AB5YxGpX1aYwibmnnszhR03 LDHVig2+rUMK0z1PBsIfbX5SY3T+HbRtQ9Tc8rzPQCuappSJjvPlIjMH3BZuVF/trJxa Fknw== 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=LPQaWBpi/AlI8Tnm+kkzOKyeVYuWeRJYS+jE3uBWsuFaAZuzci7HQp5tL2s/0f9IwV N1zT7Z29KPf/J8ylhX6XWAgWq76EMKyhBr/0fZ9fzXGstJQ6+7+0m10BeQklGSifqU6c zGRAcmkiHbf+E3+8F5I/71DUdDkZefZLIAOc9+zLThO5oe+9GSJmRPTRCuQmnIX91FZR XncY/2hVlwKCtwu5yoA7P6J8Zl3l3zLY25PC7Is7LDXMvOXtE9MKkArkIJoHRbR3onnr RuQ8PgQsUZZO9uKl88NVPwIfDRK/cmphuBx5kpHUzdb313apo+ciyTqxaJL783hZOMKH QUKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZItaLPeo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id l26si17036897edv.368.2021.12.05.21.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 21:44:49 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZItaLPeo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 782E58307B; Mon, 6 Dec 2021 06:44:48 +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="ZItaLPeo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EB0083075; Mon, 6 Dec 2021 06:44:46 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 759868083E for ; Mon, 6 Dec 2021 06:44:42 +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-x1036.google.com with SMTP id f18-20020a17090aa79200b001ad9cb23022so5214920pjq.4 for ; Sun, 05 Dec 2021 21:44:42 -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=ZItaLPeoNp92vtg80yDFiFHr4PfX0ZGn0Es8tmfDSwCltpdAJwvDLBEq8UeFFo0eQ7 ScoU3CNfznxvqZ/fxcXtmNHMCicgdU5CyNL9Ti+eyEe9AuOSRSQW723dPgr+/BW6KYEr r4y6+ZeD0cTYdfmZ0I3Aps2P5TOcD3KQt4Q7b6JwgYlrQbig2+t5Zrtxs+4YjIx8+nzo z3Y/a+QugCzDGCs+2fpYuMyoTZMuNJFu7/G8jFrAdKMBAeJf2Sl46Wf7qm41MvgY4eoL ABIVnYQTfnEuniUCrXFcZg4ymC15aViHw2W8DQ/ogm/wpV2fWMgBFvEW964jhJoOW1yk 0fAg== 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=fI1IYWfbROqkH5OrqXy5tI8pyS0xqZElE19gvOw1u1rE3Yo5OOs0oBQ5kjjnVJ5T09 nvCa+FzRS2mphQ7Hfdu0CslrzeAJrECHe9Dx1/VliGT++iHNEMW+BtOQukVgFApIH320 DRpy6rzAK7CtouZz0+Fnvfx21YlXDl/1b9L3P1ZFOEZbc6RjkuajfvpzhHIkvgqHUQJ+ tXOGEF+bbE+H28bDkPGNi5XFaOmprrsvT9FnWyPP6j1rQMRzs5hZljdII62fxFOyXx7k wGoxmV9oiEkZfqtzG/PweEqPeqdvqSyafBZyisOO2PHsRixLL3F8M9oPZ2Buz1uIwQJw ipOw== X-Gm-Message-State: AOAM5335glg3nZ5oUS8SwFaDSpkvjAQPQnWazJE0ACC9bNwWdkotpJrZ 4Ors2REDXCi4juD0quNaozlqFg== X-Received: by 2002:a17:90a:1a55:: with SMTP id 21mr34670644pjl.240.1638769480898; Sun, 05 Dec 2021 21:44:40 -0800 (PST) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id w142sm10523644pfc.115.2021.12.05.21.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 21:44:40 -0800 (PST) From: Masami Hiramatsu To: Lukasz Majewski Cc: u-boot@lists.denx.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, jaswinder.singh@linaro.org Subject: [PATCH 1/5] DFU: Do not copy the entity name over the buffer size Date: Mon, 6 Dec 2021 14:44:38 +0900 Message-Id: <163876947800.38238.12205367138412196203.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163876946986.38238.10896882043017582609.stgit@localhost> References: <163876946986.38238.10896882043017582609.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 Reviewed-by: Ilias Apalodimas --- 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;