public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu@linaro.org>
To: Lukasz Majewski <lukma@denx.de>
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	[thread overview]
Message-ID: <163876947800.38238.12205367138412196203.stgit@localhost> (raw)
In-Reply-To: <163876946986.38238.10896882043017582609.stgit@localhost>

Use strlcpy() instead of strcpy() to prevent copying the
entity name over the name buffer size.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
 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;


  reply	other threads:[~2021-12-06  5:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  5:44 [PATCH 0/5] DFU: Update dfu_alt_info parser etc Masami Hiramatsu
2021-12-06  5:44 ` Masami Hiramatsu [this message]
2022-01-03  7:40   ` [PATCH 1/5] DFU: Do not copy the entity name over the buffer size Ilias Apalodimas
2021-12-06  5:44 ` [PATCH 2/5] DFU: Accept redundant spaces and tabs in dfu_alt_info Masami Hiramatsu
2021-12-06  5:44 ` [PATCH 3/5] DFU: Check the number of arguments and argument string strictly Masami Hiramatsu
2021-12-06  5:45 ` [PATCH 4/5] doc: usage: DFU: Fix dfu_alt_info document Masami Hiramatsu
2021-12-06  5:45 ` [PATCH 5/5] cmd/dfu: Enable 'dfu list' command without DFU_OVER_USB Masami Hiramatsu
2022-01-28 16:29   ` Tom Rini
2022-01-31  0:05     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163876947800.38238.12205367138412196203.stgit@localhost \
    --to=masami.hiramatsu@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=lukma@denx.de \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox