From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D32D6C433F5 for ; Thu, 20 Jan 2022 15:29:43 +0000 (UTC) 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) 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-Google-Smtp-Source: ABdhPJyOQqsgFYz8qLJlF+4xMsz1qyueJzRjwzbdrldpHcYAoGGX/LWc8YwZfjqCSiTuRvtVn8M38A== 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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;