Browse Source

fix base64 decoding length calculation

Kolja Strohm 1 year ago
parent
commit
fbe488c7b5
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Base64.cpp

+ 2 - 1
Base64.cpp

@@ -1,4 +1,5 @@
 #include "Base64.h"
+#include <math.h>
 
 using namespace Framework;
 
@@ -62,7 +63,7 @@ bool Framework::base64Decode(Text base64, char** data, int* length)
 			return false;
 		l++;
 	}
-	*length = (l * 3) / 4;
+	*length = (int)ceil(l / 4.f) * 3;
 	*data = new char[*length + 1];
 	while (base64[k])
 	{