We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 63ab79e commit 3f6be5eCopy full SHA for 3f6be5e
cores/esp8266/base64.cpp
@@ -36,8 +36,9 @@ extern "C" {
36
* @return String
37
*/
38
String base64::encode(uint8_t * data, size_t length, bool doNewLines) {
39
- // base64 needs more size then the source data
40
- size_t size = ((length * 1.6f) + 1);
+ // base64 needs more size then the source data, use cencode.h macros
+ size_t size = ((doNewLines ? base64_encode_expected_len(length)
41
+ : base64_encode_expected_len_nonewlines(length)) + 1);
42
char * buffer = (char *) malloc(size);
43
if(buffer) {
44
base64_encodestate _state;
0 commit comments