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-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT-BimY3hFRzprPAqtdLyzMRQSXd00Gx9a4_CzZwj8TERQ@mail.gmail.com>
Date:	Mon, 30 Mar 2015 15:34:51 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Heinrich Schuchardt <xypron.glpk@....de>
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 0/3] sysctl: detect overflows when setting integers

> Unfortunately functions simple_strtoul and simple_strtoull cannot
> be replaced by kstrtoul and kstrtoull in some places, because they
> expect a zero terminated string instead of returning a pointer to
> the character after the last digit.
>
> This patch introduces two new functions kstrtoul_e and kstrtoull_e
> which fill this gap.

Well, there were two ideas:
a) to convert first, see what's left and generalize it,
b) kstrtox() should be used only in one place --
   parsing integers in proc/sysfs files.

The functions can probably be replaced by sscanf() (I didn't look closely).

I hate "_e" suffix with passion.

C in 2015 doesn't have this arcane concept known as optional
parameters so I'd suggest to hack around with always returning
number of OK characters OR add one (just one) more separate
interface

   unsigned int parse_integer(const char *s, unsigned int base, T *p);

and dispatching with __builtin_choose_expr().

Of course if someone rewrites that abomination called
sysctl parsing from scratch, maybe none of this will be needed!

  Alexey
--
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