/util/src/base64.c incorrect calculation of length in 'axutil_base64_decode_len'
--------------------------------------------------------------------------------

                 Key: AXIS2C-731
                 URL: https://issues.apache.org/jira/browse/AXIS2C-731
             Project: Axis2-C
          Issue Type: Bug
          Components: util
            Reporter: Mark Nüßler


Royston Day told me in the mailinglist about this issue, some time ago, i've 
checked this - for me Royston is right.

current implementation :

AXIS2_EXTERN int AXIS2_CALL axutil_base64_decode_len(const char *bufcoded)
{
    int nbytesdecoded;
    register const unsigned char *bufin;
    register int nprbytes;

    bufin = (const unsigned char *) bufcoded;
    while (pr2six[*(bufin++)] <= 63);

    nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;

    nbytesdecoded = ((nprbytes + 3) / 4) * 3;

    return nbytesdecoded + 1;
}

Royston implementation :

AXIS2_EXTERN int AXIS2_CALL axutil_base64_decode_len(const char *bufcoded)
{
    int nbytesdecoded;
    register const unsigned char *bufin;
    register int nprbytes;

    bufin = (const unsigned char *) bufcoded;
    while (pr2six[*(bufin++)] <= 63);

    nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;

    nbytesdecoded = ((nprbytes >> 2) * 3);

    if (nprbytes & 0x03) nbytesdecoded += (nprbytes & 0x03) - 1;

    return nbytesdecoded;
} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to