OSDN Git Service

fixed for the base64 string that has CR in the middle
authorsage <seiji.munetoh@gmail.com>
Tue, 29 Nov 2011 22:52:03 +0000 (07:52 +0900)
committersage <seiji.munetoh@gmail.com>
Tue, 29 Nov 2011 22:52:03 +0000 (07:52 +0900)
src/base64.c

index 7b4b380..d5536f7 100644 (file)
@@ -291,7 +291,7 @@ int _decodeBase64(unsigned char *out, char * in, int len) {
                            (_b64trans(inbuf[2]) >> 2);
             out[ptr2+2] = ((_b64trans(inbuf[2])&0x03) << 6) |
                             _b64trans(inbuf[3]);
-            len2 -= 4 + skip;
+            len2 -= 4; // skip chars has been removed in len2
             ptr1 += 4 + skip;
             ptr2 += 3;
         } else if ( inbuf[1] == '=' ) {