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: <20201124235908.GA28743@hoboy.vegasvil.org>
Date:   Tue, 24 Nov 2020 15:59:08 -0800
From:   Richard Cochran <richardcochran@...il.com>
To:     min.li.xe@...esas.com
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net] ptp: clockmatrix: bug fix for idtcm_strverscmp

On Tue, Nov 24, 2020 at 11:01:26AM -0500, min.li.xe@...esas.com wrote:
> From: Min Li <min.li.xe@...esas.com>
> 
> Feed kstrtou8 with NULL terminated string.
> 
> Changes since v1:
> -Use sscanf to get rid of adhoc string parse.

This is much nicer.  Small issue remains...

> +	u8 ver1[3], ver2[3];
> +	int i;
> +
> +	if (sscanf(version1, "%hhu.%hhu.%hhu",
> +		   &ver1[0], &ver1[1], &ver1[2]) < 0)
> +		return -1;

The sscanf function returns the number of scanned items, and so you
should check that it returns 3 (three).

> +	if (sscanf(version2, "%hhu.%hhu.%hhu",
> +		   &ver2[0], &ver2[1], &ver2[2]) < 0)
> +		return -1;

Same here.

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ