lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024082430-unlatch-antennae-0ea7@gregkh>
Date: Sat, 24 Aug 2024 13:45:00 +0800
From: Greg KH <gregkh@...uxfoundation.org>
To: Abhishek Tamboli <abhishektamboli9@...il.com>
Cc: tdavies@...kphysics.net, philipp.g.hortmann@...il.com,
	garyrookard@...tmail.org, linux-staging@...ts.linux.dev,
	skhan@...uxfoundation.org, rbmarliere@...il.com,
	dan.carpenter@...aro.org, christophe.jaillet@...adoo.fr,
	linux-kernel-mentees@...ts.linuxfoundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: rtl8192e: Replace strcpy with strcat in
 rtl819x_translate_scan

On Fri, Aug 23, 2024 at 09:04:11PM +0530, Abhishek Tamboli wrote:
> Replace strcpy() with strcat() in rtl819x_translate_scan()
> Also Fix proto_name[] buffer size issue to accommodate all
> network modes.

When you say "also" in a changelog text, that's a huge hint that this
should probably be split up into multiple changes.  Please do that here.

More comments below.

> Signed-off-by: Abhishek Tamboli <abhishektamboli9@...il.com>
> ---
> Changes in v2:
> - Revert the use of strscpy and replaced it with strcat.
> - Remove the 'pname' and replace it's usage with direct
> operations on 'proto_name' buffer.
> 
>  drivers/staging/rtl8192e/rtllib_wx.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index fbd4ec824084..ec0c4c5bade7 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -23,14 +23,14 @@ static const char * const rtllib_modes[] = {
>  };
> 
>  #define MAX_CUSTOM_LEN 64
> +#define MAX_PROTO_NAME_LEN 10

Where did this "10" come from?  What sets this limit?  Why not 100?
1000?  2?  You get the idea :)


>  static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
>  					   char *start, char *stop,
>  					   struct rtllib_network *network,
>  					   struct iw_request_info *info)
>  {
>  	char custom[MAX_CUSTOM_LEN];
> -	char proto_name[6];
> -	char *pname = proto_name;
> +	char proto_name[MAX_PROTO_NAME_LEN];
>  	char *p;
>  	struct iw_event iwe;
>  	int i, j;
> @@ -59,13 +59,12 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
>  	}
>  	/* Add the protocol name */
>  	iwe.cmd = SIOCGIWNAME;
> +	/* Initialise proto_name as an empty string*/
> +	memset(proto_name, '\0', sizeof(proto_name));
>  	for (i = 0; i < ARRAY_SIZE(rtllib_modes); i++) {
> -		if (network->mode & BIT(i)) {
> -			strcpy(pname, rtllib_modes[i]);
> -			pname += strlen(rtllib_modes[i]);
> +		if (network->mode & BIT(i))
> +			strcat(proto_name, rtllib_modes[i]);
>  		}
> -	}

I think the } placement is now incorrect, right?  Did you run checkpatch
on this change?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ