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: <10621e048f62018432c42a3fccc1a5fd9a6d71d7.camel@perches.com>
Date:   Sat, 10 Jul 2021 10:04:48 -0700
From:   Joe Perches <joe@...ches.com>
To:     Salah Triki <salah.triki@...il.com>, dan.j.williams@...el.com,
        vishal.l.verma@...el.com, dave.jiang@...el.com
Cc:     nvdimm@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dax: replace sprintf() by scnprintf()

On Sat, 2021-07-10 at 17:46 +0100, Salah Triki wrote:
> Replace sprintf() by scnprintf() in order to avoid buffer overflows.

OK but also not strictly necessary.  DAX_NAME_LEN is 30.

Are you finding and changing these manually or with a script?

> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
[]
> @@ -76,7 +76,7 @@ static ssize_t do_id_store(struct device_driver *drv, const char *buf,
>  	fields = sscanf(buf, "dax%d.%d", &region_id, &id);
>  	if (fields != 2)
>  		return -EINVAL;
> -	sprintf(devname, "dax%d.%d", region_id, id);
> +	scnprintf(devname, DAX_NAME_LEN, "dax%d.%d", region_id, id);
>  	if (!sysfs_streq(buf, devname))
>  		return -EINVAL;
>  
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ