mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Bodo Rzany <bodo@rzany.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: is there small mistake in lib/vsprintf.c of kernel 2.4.20 ?
Date: Fri, 2 May 2003 10:08:35 +0100	[thread overview]
Message-ID: <20030502090835.GX10374@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.44.0305021018070.493-100000@joel.ro.ibrro.de>

On Fri, May 02, 2003 at 11:06:32AM +0200, Bodo Rzany wrote:
> PROBLEM:
> 	Hex/Octal decoding with sscanf from kernel library does not work
> 	within kernel 2.4.20
> 
> DESCRIPTION:
> 	Line 570 in lib/vsprintf.c
> 
> 			14677 11. Okt 2001  vsprintf.c
> 
> 	holds '	base = 10; '
> 
> 	which prevents the real conversion routines ('simple_strtoul' a.s.o.)
> 	from decoding numbers from bases other than 10.

It's not a problem, it's standard-mandated behaviour.

>From vsscanf(3):
       The following conversions are available:
...
       d      Matches  an  optionally signed decimal integer; the next pointer
              must be a pointer to int.
...
       i      Matches an optionally signed integer; the next pointer must be a
              pointer  to  int.   The  integer is read in base 16 if it begins
              with `0x' or `0X', in base 8 if it begins with `0', and in  base
              10  otherwise.   Only characters that correspond to the base are
              used.

IOW, %d _does_ mean base=10.  base=0 is %i.  That goes both for kernel and
userland implementations of scanf family (and for any standard-compliant
implementation, for that matter).

  reply	other threads:[~2003-05-02  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02  9:06 Bodo Rzany
2003-05-02  9:08 ` viro [this message]
2003-05-02  9:42   ` Bodo Rzany
2003-05-02  9:50     ` viro
2003-05-02 15:03       ` Kevin Corry
2003-05-02 15:27         ` Richard B. Johnson
2003-05-02 16:52           ` Jonathan Lundell
2003-05-02 17:20             ` Richard B. Johnson
     [not found] <BKEGKPICNAKILKJKMHCAKEBLCKAA.Riley@Williams.Name>
2003-05-02 17:15 ` Richard B. Johnson
2003-05-02 18:23   ` Kevin Corry

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=20030502090835.GX10374@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=bodo@rzany.de \
    --cc=linux-kernel@vger.kernel.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®