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, 23 Mar 2011 17:30:11 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Jonathan Cameron <jic23@....ac.uk>
Cc:	linux-kernel@...r.kernel.org, greg@...ah.com, rusty@...tcorp.com.au
Subject: Re: [PATCH 1/3] Add a kstrtobool function matching semantics of
 existing in kernel equivalents.

On Wed, Mar 23, 2011 at 3:39 PM, Jonathan Cameron <jic23@....ac.uk> wrote:
> +int kstrtobool(const char *s, bool *res)
> +{
> +       switch (s[0]) {
> +       case 'y':
> +       case 'Y':
> +       case '1':
> +               *res = true;
> +       case 'n':
> +       case 'N':
> +       case '0':
> +               *res = false;
> +       default:
> +               return -EINVAL;
> +       }
> +       return 0;
> +}

sigh... such simple thing and so many bugs

The only values such function should accept is 0 and 1.

Have you read the rest of kstrto*() code?
Where is newline check?

Anyway, I think it's better do not exist.
--
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