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]
Date:	Thu, 18 Jul 2013 14:52:21 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Al Viro <viro@...IV.linux.org.uk>
CC:	linux@...izon.com, Jiri Kosina <jkosina@...e.cz>,
	andriy.shevchenko@...ux.intel.com, andrei.emeltchenko@...el.com,
	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lib/vsprintf.c: fix the incorrect return value of vsnprintf()

On 07/18/2013 02:49 PM, Al Viro wrote:
> On Thu, Jul 18, 2013 at 02:28:49PM +0800, Chen Gang wrote:
>> > When "str >= end", necessary to reset 'str' to "end - 1", or the return
>> > value will be larger than the real one, the callers which depend on the
>> > return value, may cause memory overflow.
> You do realize that snprintf(s, 1, "abc") should return 3, not 1?  The
> goal off snprintf() is _not_ just to truncate the output; return value
> tells how much should the buffer had been to fit the whole thing.
> 
> 

It is my fault, thanks.

-- 
Chen Gang
--
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