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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 10 Nov 2010 13:08:34 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Vasiliy Kulikov <segooon@...il.com>
Cc:	kernel-janitors@...r.kernel.org,
	André Goddard Rosa <andre.goddard@...il.com>,
	Joe Perches <joe@...ches.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Bjorn Helgaas <bjorn.helgaas@...com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib: vsprintf: fix invalid arg check

On Wed, 10 Nov 2010 23:38:08 +0300
Vasiliy Kulikov <segooon@...il.com> wrote:

> "size" is size_t.  If we want to check whether it was underflowed
> then we should cast it to ssize_t instead of int.  When
> sizeof(size_t) > sizeof(int) the code sees UINT_MAX as underflow,
> but it is not.
> 

Does this patch fix any actual observed problem?

>  Compile tested.
> 

I guess not.

> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1290,7 +1290,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
>  
>  	/* Reject out-of-range values early.  Large positive sizes are
>  	   used for unknown buffer sizes. */

Thousands of people would find that comment to be utterly mysterious. 
I am one.

> -	if (WARN_ON_ONCE((int) size < 0))
> +	if (WARN_ON_ONCE((ssize_t) size < 0))
>  		return 0;
>  
>  	str = buf;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ