cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl_base64_decode not mod 3 issue

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 19 Dec 2002 16:57:42 +0100 (MET)

On Thu, 19 Dec 2002, matthew b wrote:

> Hi. I needed a base64 decoder, and since I was using curl anyway I thought
> I'd try base64.c in anticipation of it being part of the exported library.
> (I say passing in a pre-existing buffer is OK for a base64 encode and
> decode interface since the size is deterministic, but don't have the feel
> of the curl interface enough to say if it's consistent.)

The interface has become like this more or less out of a coincidence, as it
hasn't been that very much planning behind how it turned out.

> Anyway, the version on my machine (base64.c,v 1.14 2002/09/03) doesn't seem
> to propertly handle the case when the size of the enencoded message is not
> a multiple of 3. I made two small tweaks to fix it, and it seems to work
> now.

Thanks for the patch! The decoder is really very rarely used and I guess
that's the explanation for this long-lasting bug.

Did you happen to test this with some inputs to prove it working? If so,
could you please post the code and I'd be happy to add it to the test suite!

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/
Received on 2002-12-19