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] [day] [month] [year] [list]
Message-ID: <20221016173732.1c28ab90@jic23-huawei>
Date:   Sun, 16 Oct 2022 17:37:41 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Matti Vaittinen <mazziesaccount@...il.com>
Cc:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Hartmut Knaack <knaack.h@....de>, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tools: iio: iio_utils: fix digit calculation

On Thu, 13 Oct 2022 15:04:04 +0300
Matti Vaittinen <mazziesaccount@...il.com> wrote:

> The iio_utils uses a digit calculation in order to know length of the
> file name containing a buffer number. The digit calculation does not
> work for number 0.
> 
> This leads to allocation of one character too small buffer for the
> file-name when file name contains value '0'. (Eg. buffer0).
> 
> Fix digit calculation by returning one digit to be present for number
> '0'.
> 
> Fixes: 096f9b862e60 ("tools:iio:iio_utils: implement digit calculation")
> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
hi Matti

Makes sense.

Applied to the fixes-togreg branch of iio.git and marked for stable.


Thanks,

Jonathan

> ---
>  tools/iio/iio_utils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
> index aadee6d34c74..8d35893b2fa8 100644
> --- a/tools/iio/iio_utils.c
> +++ b/tools/iio/iio_utils.c
> @@ -547,6 +547,10 @@ static int calc_digits(int num)
>  {
>  	int count = 0;
>  
> +	/* It takes a digit to represent zero */
> +	if (!num)
> +		return 1;
> +
>  	while (num != 0) {
>  		num /= 10;
>  		count++;
> 
> base-commit: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ