mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Deepak Saxena <dsaxena@mvista.com>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org,
	marcelo.tosatti@cyclades.com.br
Subject: Re: [PATCH] Fix %x parsing in vsscanf()
Date: Tue, 23 Sep 2003 22:26:40 +0100	[thread overview]
Message-ID: <20030923212640.GM7665@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20030923212207.GA25234@xanadu.az.mvista.com>

On Tue, Sep 23, 2003 at 02:22:07PM -0700, Deepak Saxena wrote:
> 
> The existing code in kernel/vsprintf.c:vsscanf() does not properly 
> handle the case where the format is specfied as %x or %X and the
> string contains the number in the format "0xinteger". Instead of
> reading "0xinteger", the code currently only sees the '0' and treats
> the 'x' as a delimiter. Following patch (against 2.4 and 2.6) fixes
> this.  Another option is to put the check in simple_strtoul() and
> simple_strtoull() if that is preferred. I like this better b/c
> we only have the check once.
 
	We should put that into strtoul().  Rationale:

<quote>
If the value of base is 16, the characters 0x or 0X may optionally precede
the sequence of letters and digits, following the sign if present.
</quote>

That's from C99 7.20.1.4 (definition of strtoul and friends) and it does
match the normal userland behaviour of strtoul(3) on all platforms I'd
seen...

  reply	other threads:[~2003-09-23 21:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-23 21:22 Deepak Saxena
2003-09-23 21:26 ` viro [this message]
2003-09-23 21:28 ` Linus Torvalds
2003-09-23 21:35   ` viro
2003-09-23 22:16     ` Deepak Saxena
2003-09-23 22:26       ` viro
2003-09-24  1:02         ` Deepak Saxena
2003-09-24  0:55           ` viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030923212640.GM7665@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=dsaxena@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com.br \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®