Fix decoding of base64. We got the length wrong when the result was not
authorVolker Lendecke <vlendec@samba.org>
Fri, 23 Jan 2004 12:04:07 +0000 (12:04 +0000)
committerVolker Lendecke <vlendec@samba.org>
Fri, 23 Jan 2004 12:04:07 +0000 (12:04 +0000)
an exact multiple of 3.

I also wrote a torture test and it survived some minutes of random stuff
coded/decoded up to 16 MB data. But that would be a bit too embarassing to
commit... :-)

Volker

source/lib/util_str.c

index d93f39696f4862234b1ff9a4313f40cf83310a56..822ab2062869f84dc0d6479e2c5c47ad1db58e7e 100644 (file)
@@ -1838,6 +1838,8 @@ DATA_BLOB base64_decode_data_blob(const char *s)
                s++; i++;
        }
 
+       if (*s == '=') n -= 1;
+
        /* fix up length */
        decoded.length = n;
        return decoded;