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]
Date:	Wed, 24 Feb 2016 01:01:57 +0100
From:	Rasmus Villemoes <linux@...musvillemoes.dk>
To:	Jessica Yu <jeyu@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] sscanf: implement basic character sets

On Tue, Feb 23 2016, Rasmus Villemoes <linux@...musvillemoes.dk> wrote:

> On that note, it seems that your field width handling is off-by-one.

Sorry about that, it's me who's off-by-one.

Rasmus


> To get rid of the allocation, why not use a small bitmap? Something like
>
> {
>   char *s = (char *)va_arg(args, char *);
>   DECLARE_BITMAP(map, 256) = {0};
>   bool negate = false;
>
>   /* a field width is required, and must provide room for at least a '\0' */
>   if (field_width <= 0)
>     return num;
>

should be

/* a field width is required */
if (field_width < 0)

and

>   while (test_bit((u8)*str, map) && --field_width) {

should be field_width--, exactly as in your code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ