Commit f28ded9f authored by Michael Smith's avatar Michael Smith

A bug report indirectly suggested the base64 decode code was confusing (as the

treatment of padding was un-obvious), so added a comment explaining it.

svn path=/icecast/trunk/icecast/; revision=9075
parent d43484d4
...@@ -463,6 +463,10 @@ char *util_base64_decode(unsigned char *input) ...@@ -463,6 +463,10 @@ char *util_base64_decode(unsigned char *input)
} }
*out++ = vals[0]<<2 | vals[1]>>4; *out++ = vals[0]<<2 | vals[1]>>4;
/* vals[3] and (if that is) vals[2] can be '=' as padding, which is
looked up in the base64decode table as '-1'. Check for this case,
and output zero-terminators instead of characters if we've got
padding. */
if(vals[2] >= 0) if(vals[2] >= 0)
*out++ = ((vals[1]&0x0F)<<4) | (vals[2]>>2); *out++ = ((vals[1]&0x0F)<<4) | (vals[2]>>2);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment