From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bo YU <tsu.yubo@gmail.com>
Cc: gregkh@linuxfoundation.org, christian.gromm@microchip.com,
colin.king@canonical.com, andrey.shvetsov@k2l.de,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: most: protect potential string overflow
Date: Wed, 24 Apr 2019 17:55:05 +0300 [thread overview]
Message-ID: <20190424145505.GE14798@kadam> (raw)
In-Reply-To: <20190423022018.12214-1-tsu.yubo@gmail.com>
On Mon, Apr 22, 2019 at 10:20:18PM -0400, Bo YU wrote:
> There maybe cause potential string overflow issue due to use
> strcpy without checking the length
>
> Detected By CoversityScan CID# 1444760
>
> Fixes: 131ac62253dba:(staging: most: core: use device description as name)
It doesn't really fix anything, it just silences a static checker
warning.
> Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> ---
> drivers/staging/most/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
> index 956daf8c3bd2..0f26cebac91a 100644
> --- a/drivers/staging/most/core.c
> +++ b/drivers/staging/most/core.c
> @@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface *iface)
>
> INIT_LIST_HEAD(&iface->p->channel_list);
> iface->p->dev_id = id;
> - strcpy(iface->p->name, iface->description);
> + strlcpy(iface->p->name, iface->description, sizeof(iface->p->name));
We prefer strscpy() more than strlcpy() these days.
regards,
dan carpenter
next prev parent reply other threads:[~2019-04-24 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 2:20 [PATCH] staging: most: protect potential string overflow Bo YU
2019-04-24 14:55 ` Dan Carpenter [this message]
2019-04-26 3:44 ` Bo YU
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=20190424145505.GE14798@kadam \
--to=dan.carpenter@oracle.com \
--cc=andrey.shvetsov@k2l.de \
--cc=christian.gromm@microchip.com \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tsu.yubo@gmail.com \
/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