lkml.org 
[lkml]   [2003]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Fix %x parsing in vsscanf()
    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...
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:48    [W:0.033 / U:29.964 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site