Richard Levitte - VMS Whacker <[EMAIL PROTECTED]> writes:

> OK, the bug is found.  This is the code that causes the problem, do
> you think you can spot it?  A hint: the integer part will *always* be
> truncated to the three least significant digits...
> 
>     /* convert integer part */
>     do {
>         iconvert[iplace++] =
>             (caps ? "0123456789ABCDEF"
>               : "0123456789abcdef")[intpart % 10];
>         intpart = (intpart / 10);
>     } while (intpart && (iplace < (int)sizeof(iplace)));

sizeof(iplace) should have been sizeof(iconvert). Since sizeof an
int most likely is 4, you will only loop 3 times.

>     if (iplace == sizeof iplace)

Same bug here, I think.

>         iplace--;
>     iconvert[iplace] = 0;


A bit further in the code....

    /* convert fractional part */
    do {
        fconvert[fplace++] =
            (caps ? "0123456789ABCDEF"
              : "0123456789abcdef")[fracpart % 10];
        fracpart = (fracpart / 10);
    } while (fplace < max);
    if (fplace == sizeof fplace)

Same bug. Should probably be sizeof(fconvert), not fplace.

        fplace--;
    fconvert[fplace] = 0;

-- 
Jostein Tveit ([EMAIL PROTECTED])
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to