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:	Sun, 5 Aug 2007 02:49:02 +0400
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Satyam Sharma <satyam@...radead.org>
Cc:	Jan Engelhardt <jengelh@...putergmbh.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm] Introduce strtol_check_range()

On Fri, Aug 03, 2007 at 02:29:06PM +0530, Satyam Sharma wrote:
> On Fri, 3 Aug 2007, Jan Engelhardt wrote:
> 
> > 
> > On Aug 2 2007 05:16, Satyam Sharma wrote:
> > >
> > >BSD's strtonum(3) is a detestful, horrible shame.
> > >
> > >The strtol_check_range() I implemented here does _all_ that strtonum()
> > >does, plus is generic w.r.t. base, and minus the tasteless "errstr"
> > >argument.
> > >
> > >Tell me, how does that "errstr" ever make sense? We _anyway_ return
> > >errors (-EINVAL or -ERANGE) if any of those cases show up.
> > 
> > errstr (well, at least for strtol) are useful to find the first character that
> > does not make up a number (and then do whatever the user wants to, including,
> > continuing to parse). For example "chown 0:1337", strtol on "0:1337" should
> > give errstr=pointer to the ":", then check for it being a ':', then you know
> > the next char is the GID. :)
> 
> We were actually discussing the "errstr" that's the fourth argument of
> BSD's strtonum(3) which has quite radically different semantics [1]
> from the "endptr" argument of strtol(3).

Glad you've noticed.

> Anyway, I originally
> misunderstood the interface / the correct way to be using that function
> as I later mentioned in the other mail -- also see the answer to point
> #3 in [2]. Porting it over to here does sound like a good idea.

> [1] http://www.freebsd.org/cgi/man.cgi?query=strtonum&apropos=0&sektion=3&manpath=FreeBSD+7-current&format=html
> [2] http://lists.freebsd.org/pipermail/freebsd-current/2005-April/048744.html

Actually, strtonum() rejects "42\n" which means we can't massively use
it. :-(

-
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