]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/base64.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / common / base64.cpp
index bf5a613dff15beae9d4b9a622831a3aa248340f1..d83daee68236e4ccc8598377a42c7dfbc20a9c44 100644 (file)
@@ -187,8 +187,15 @@ wxBase64Decode(void *dst_, size_t dstLen,
 
                 // undo the bit shifting done during encoding
                 *dst++ = in[0] << 2 | in[1] >> 4;
 
                 // undo the bit shifting done during encoding
                 *dst++ = in[0] << 2 | in[1] >> 4;
-                *dst++ = in[1] << 4 | in[2] >> 2;
-                *dst++ = in[2] << 6 | in[3];
+
+                // be careful to not overwrite the output buffer with NUL pad
+                // bytes
+                if ( padLen != 2 )
+                {
+                    *dst++ = in[1] << 4 | in[2] >> 2;
+                    if ( !padLen )
+                        *dst++ = in[2] << 6 | in[3];
+                }
             }
 
             n = 0;
             }
 
             n = 0;