linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: sgruszka@redhat.com, linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy
Date: Sun, 20 Jan 2013 17:31:35 +0800	[thread overview]
Message-ID: <50FBB977.7080805@asianux.com> (raw)
In-Reply-To: <50EA5246.8060206@asianux.com>

Hello all:

  sorry, after checking the details:
    I think this patch is incorrect.
      we can not assume that the parameter "char *buf" is terminated by '\0'
      so we should only use strlcpy instead of strncpy, without touching 'min(...'

  since it is already integrated into main branch (at least, in next-20130118).
    I should send additional patch to fix it.

  please help to check, thanks.


gchen.


于 2013年01月07日 12:42, Chen Gang 写道:
> 
>   The fields must be null-terminated, or simple_strtoul will cause issue.
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  drivers/net/wireless/iwlegacy/3945-mac.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
> index d604b40..3726cd6 100644
> --- a/drivers/net/wireless/iwlegacy/3945-mac.c
> +++ b/drivers/net/wireless/iwlegacy/3945-mac.c
> @@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,
>  
>  	if (count) {
>  		char *p = buffer;
> -		strncpy(buffer, buf, min(sizeof(buffer), count));
> +		strlcpy(buffer, buf, sizeof(buffer));
>  		channel = simple_strtoul(p, NULL, 0);
>  		if (channel)
>  			params.channel = channel;
> 


-- 
Chen Gang

Asianux Corporation

  parent reply	other threads:[~2013-01-20  9:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07  4:42 [PATCH] drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy Chen Gang
2013-01-07 11:17 ` Stanislaw Gruszka
2013-01-10  8:48   ` Chen Gang F T
2013-01-20  9:31 ` Chen Gang [this message]
2013-01-20 10:45   ` Chen Gang F T

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=50FBB977.7080805@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgruszka@redhat.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;
as well as URLs for NNTP newsgroup(s).