Coder Social home page Coder Social logo

base64's People

Contributors

agdl avatar gitneko avatar per1234 avatar phretor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

base64's Issues

please use const char * when possible

Hi!
Thanks for the nice library.

You might want to update the member functions to use const char* for compatibility with the Arduino String class?
As per:

int encode(char *output, const char *input, int inputLength);
int decode(char * output, const char * input, int inputLength);
int decodedLength(const char * input, int inputLength);

corrected files are attached.
Thanks!
B
src.zip

Heap corruption in Base64.encode and Base64.decode

The code provided by the examples can cause memory corruptions, because the expected output buffers for Base64.encode and Base64.decode are actual Base64.encodedLength() + 1 and Base64.decodedLength() + 1.

So, the examples should look something like this:
int encodedLength = Base64.encodedLength(inputStringLength);
char encodedString[encodedLength + 1];
Base64.encode(encodedString, inputString, inputStringLength);

int decodedLength = Base64.decodedLength(inputString, inputStringLength);
char decodedString[decodedLength + 1];
Base64.decode(decodedString, inputString, inputStringLength);

In general, I think that this additional null termination bytes arn't really necessary and should be removed from the encode and decode functions. Especially when using the library to encode and decode abritrary binary data, nobody is expecting a null termination at this point.

Library does not compile for ESP8266

Compiling the provided examples with the Arduino IDE will fail, when the processor is an ESPxxxx.

exit status 1
'Base64' was not declared in this scope

Base64 not working with PlatformIO?

I'm not sure if this is an issue or just an oversight on my part, but it seems that out of the box, PlatformIO is not producing working project configurations for access to onboard built-in libraries.. or else I'm mis-interpreting the following session, which intention is to simply prove that current PlatformIO is suitable to use the Base64 library - however, a newly configured project seems unable to find the libraries:

 seclorum@github:~/ {}
$ pio --version
PlatformIO, version 3.0.1
 seclorum@github:~/ {}
$ mkdir ~/Documents/platformIO/hak/t_proj/ && cd ~/Documents/platformIO/hak/t_proj/
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ pio init --board esp12e

The current working directory /Users/seclorum/Documents/platformIO/hak/t_proj will be used for project.
You can specify another project directory via
`platformio init -d %PATH_TO_THE_PROJECT_DIR%` command.

The next files/directories have been created in /Users/seclorum/Documents/platformIO/hak/t_proj
platformio.ini - Project Configuration File
src - Put your source files here
lib - Put here project specific (private) libraries

Project has been successfully initialized!
Useful commands:
`platformio run` - process/build project from the current directory
`platformio run --target upload` or `platformio run -t upload` - upload firmware to embedded board
`platformio run --target clean` - clean project (remove compiled files)
`platformio run --help` - additional information
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ pio lib install Base64
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ pio lib list
Library Storage: /Users/seclorum/Documents/platformIO/hak/t_proj/.piolibdeps
[ ID  ] Name             Compatibility         "Authors": Description
---------------------------------------------------------------------------------------------------------
[ 582 ] Base64           arduino, atmelavr, atmelsam, espressif8266, intel_arc32, microchippic32, nordicnrf51, teensy, timsp430 "Arturo Guadalupi": A Base64 library for Arduino | @0.0.1
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ ls -l
total 8
drwxr-xr-x+ 3 j  staff  102 Sep  8 15:50 lib
-rw-r--r--+ 1 j  staff  495 Sep  8 16:04 platformio.ini
drwxr-xr-x+ 3 j  staff  102 Sep  8 16:11 src
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ cp ~/.platformio/lib/Base64_ID582/examples/Base64Decode/Base64Decode.ino src/
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ pio run -v
[Thu Sep  8 16:11:15 2016] Processing esp12e (platform: espressif8266, build_flags: -Wl,-Tesp8266.flash.4m.ld -lstdc++ -lsupc++  -Ilib/Base64 -lBase64, board: esp12e, framework: arduino)
---------------------------------------------------------------------------------------------------------
xtensa-lx106-elf-g++ -o "/Users/seclorum/Documents/platformIO/hak/t_proj/src/Base64Decode.ino.cpp" -x c++ -fpreprocessed -dD -E "/var/folders/48/yjv7rc1x3bd010gv32lkwyzm0000gq/T/tmp5gusvX"
Collected 32 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <Base64> v0.0.1 (/Users/seclorum/Documents/platformIO/hak/t_proj/.piolibdeps/Base64_ID582)
xtensa-lx106-elf-g++ -o .pioenvs/esp12e/src/Base64Decode.ino.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu -I.piolibdeps/Base64_ID582/src -Isrc src/Base64Decode.ino.cpp
/Users/seclorum/Documents/platformIO/hak/t_proj/src/Base64Decode.ino: In function 'void setup()':
/Users/seclorum/Documents/platformIO/hak/t_proj/src/Base64Decode.ino:33:23: error: 'Base64' was not declared in this scope
char decodedString[decodedLength];
^
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_i2s.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_i2s.c
xtensa-lx106-elf-g++ -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_main.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_main.cpp
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_noniso.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_noniso.c
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_phy.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_phy.c
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_postmortem.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_postmortem.c
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_si2c.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_si2c.c
*** [.pioenvs/esp12e/src/Base64Decode.ino.o] Error 1
xtensa-lx106-elf-gcc -o .pioenvs/esp12e/FrameworkArduino/core_esp8266_timer.o -c -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=030001 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP12 -U__STRICT_ANSI__ -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/tools/sdk/lwip/include -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266 -I/Users/seclorum/.platformio/platforms/espressif8266/builder/frameworks/lib/Base64 -I/Users/seclorum/.platformio/packages/framework-arduinoespressif/variants/nodemcu /Users/seclorum/.platformio/packages/framework-arduinoespressif/cores/esp8266/core_esp8266_timer.c
======================================= [ERROR] Took 1.35 seconds =======================================
seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ ls -l ~/.platformio/lib/Base64_ID582/
.library.json       README.adoc         keywords.txt        src/
LICENSE             examples/           library.properties
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$  ls -l ~/.platformio/lib/Base64_ID582/src/
total 16
-rw-rw-r--  1 j  staff  3218 May  4 10:11 Base64.cpp
-rw-rw-r--  1 j  staff  1116 Sep  8 14:12 Base64.h
seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ tree
.
├── cscope.out
├── lib
│   └── readme.txt
├── platformio.ini
└── src
    └── Base64Decode.ino

2 directories, 4 files
 seclorum@github:~/Documents/platformIO/hak/t_proj {}
$ cat src/Base64Decode.ino
/*
  Base64 decode example

  Decodes the text "QmFzZTY0RGVjb2RlRXhhbXBsZQA=" to "Base64DecodeExample"

  Created 04 May 2016
  by Arturo Guadalupi

  This example code is in the public domain.

*/

#include <Base64.h>

void setup()
{
  // start serial port at 115200 bps:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB only
  }

  // encoding
  char inputString[] = "QmFzZTY0RGVjb2RlRXhhbXBsZQA=";
  int inputStringLength = sizeof(inputString);

  Serial.print("Input string is:\t");
  Serial.println(inputString);

  Serial.println();

  int decodedLength = Base64.decodedLength(inputString, inputStringLength);
  char decodedString[decodedLength];
  Base64.decode(decodedString, inputString, inputStringLength);
  Serial.print("Decoded string is:\t");
  Serial.println(decodedString);
}


void loop() {

}

I reported this issue to the PlatformIO guys, but they said its an issue with Base64.

Any clues why this is not working like it used to?

Bad / Missing ending on decoded content

Hi! I'm trying to use your library but I have a problem, probably i use it the bad way.

I encode and decode the same string or array of bytes but I can't obtain the same result.

    char m[] = "'I FINK U FREEKY' by DIE ANTWOORD xxx (Official)";

    Serial.println(m);

    char mBase64[128];

    int base64Length = Base64.encode(mBase64, (char *)m, sizeof(m));

    Serial.println(mBase64);

    int dLength = Base64.decodedLength(mBase64, strlen(mBase64)); 

    char m2[dLength];

    Base64.decode(m2, mBase64, dLength);

    Serial.println(m2);

Result

'I FINK U FREEKY' by DIE ANTWOORD xxx (Official)
J0kgRklOSyBVIEZSRUVLWScgYnkgRElFIEFOVFdPT1JEIHh4eCAoT2ZmaWNpYWwpAA==
'I FINK U FREEKY' by DIE ANTWOORD xx <- Humm?
    char m[] = { 0x57, 0x2a, 0x63, 0x79, 0x3a, 0x9f, 0x76, 0x60, 0x66, 0xcf, 0x50, 0x59, 0x1c, 0x8f, 0x97, 0x49, 0x92, 0xba, 0x71, 0x14, 0x27, 0xb5, 0x2c, 0x6c, 0xf1, 0xa4, 0x7a, 0x4b, 0xc8, 0x13, 0xe6, 0x93 };

    Serial.println(m);

    for (uint8_t i = 0; i < sizeof(m); i++)
    {
        Serial.print(m[i], HEX);
        Serial.print(" ");
    }

    Serial.println();

    char mBase64[128];

    int base64Length = Base64.encode(mBase64, (char *)m, sizeof(m));

    Serial.println(mBase64);

    int dLength = Base64.decodedLength(mBase64, strlen(mBase64)); 

    char m2[dLength];

    Base64.decode(m2, mBase64, dLength);

    for (uint8_t i = 0; i < sizeof(m2); i++)
    {
        Serial.print(m2[i], HEX);
        Serial.print(" ");
    }

Result

57 2A 63 79 3A 9F 76 60 66 CF 50 59 1C 8F 97 49 92 BA 71 14 27 B5 2C 6C F1 A4 7A 4B C8 13 E6 93 
VypjeTqfdmBmz1BZHI+XSZK6cRQntSxs8aR6S8gT5pM=
57 2A 63 79 3A 9F 76 60 66 CF 50 59 1C 8F 97 49 92 BA 71 14 27 B5 2C 6C 0 A5 A5 A5 A5 A5 A5 A5  <- Humm?

Same exercice using another library (densaugeo/base64@^1.4.0):

    char m[] = "'I FINK U FREEKY' by DIE ANTWOORD xxx (Official)";

    Serial.println(m);

    char mBase64[128];

    int base64_length = encode_base64((unsigned char *)m, sizeof(m), (unsigned char *)mBase64);

    Serial.println(mBase64);

    char m2[128];

    int decoded_length = decode_base64((unsigned char *)mBase64, (unsigned char *) m2);

    Serial.println(m2);

Result

'I FINK U FREEKY' by DIE ANTWOORD xxx (Official)
J0kgRklOSyBVIEZSRUVLWScgYnkgRElFIEFOVFdPT1JEIHh4eCAoT2ZmaWNpYWwpAA==
'I FINK U FREEKY' by DIE ANTWOORD xxx (Official) <- OK!
    char m[] = { 0x57, 0x2a, 0x63, 0x79, 0x3a, 0x9f, 0x76, 0x60, 0x66, 0xcf, 0x50, 0x59, 0x1c, 0x8f, 0x97, 0x49, 0x92, 0xba, 0x71, 0x14, 0x27, 0xb5, 0x2c, 0x6c, 0xf1, 0xa4, 0x7a, 0x4b, 0xc8, 0x13, 0xe6, 0x93 };

    for (uint8_t i = 0; i < sizeof(m); i++)
    {
        Serial.print(m[i], HEX);
        Serial.print(" ");
    }

    Serial.println();

    char mBase64[128];

    int base64_length = encode_base64((unsigned char *)m, sizeof(m), (unsigned char *)mBase64);

    Serial.println(mBase64);

    char m2[128];

    int decoded_length = decode_base64((unsigned char *)mBase64, (unsigned char *) m2);

    for (uint8_t i = 0; i < decoded_length; i++)
    {
        Serial.print(m2[i], HEX);
        Serial.print(" ");
    }

Result

57 2A 63 79 3A 9F 76 60 66 CF 50 59 1C 8F 97 49 92 BA 71 14 27 B5 2C 6C F1 A4 7A 4B C8 13 E6 93
VypjeTqfdmBmz1BZHI+XSZK6cRQntSxs8aR6S8gT5pM=
57 2A 63 79 3A 9F 76 60 66 CF 50 59 1C 8F 97 49 92 BA 71 14 27 B5 2C 6C F1 A4 7A 4B C8 13 E6 93 <- OK!

The encoding part looks fine, I have the same result with both libraries and I checked it with an online tool.

But there is something bad on the decoding side.

Any idea?

Proposed fix

Substitute

#include <avr\pgmspace.h>

with

#if (defined(__AVR__))
#include <avr\pgmspace.h>
#else
#include <pgmspace.h>
#endif

Include fails with Arduino board RP2040 Connect

Hello,
I have compiling errors when using Base64 on a script for an Arduino RP2040 Connect. When I import the library, there are no errors but it is as if nothing happened. It says that Base64 is not defined wherever I try to use it.
The issue is specific to the board I use : an Arduino RP2040 Connect. I tried compiling the same script for a regular Arduino Nano and it works fine.

Exemple :

#include <Base64.h>

void setup() {
  int encodedLength = Base64.encodedLength(42);
}

void loop() {}

Output :

C:\Users\Léopold\Documents\Associatif\Minotaure\Projet Initiation\Code\Test\Test.ino: In function 'void setup()':
C:\Users\Léopold\Documents\Associatif\Minotaure\Projet Initiation\Code\Test\Test.ino:4:23: error: 'Base64' was not declared in this scope

exit status 1

Compilation error: 'Base64' was not declared in this scope

The error message with verbose enabled

System info :
Arduino IDE 2.2.1
library -> agdl/Base64 1.0.0

string length error in the two examples

Both the encode and decode example calculate inputStringLength with the following

int inputStringLength = sizeof(inputString);

I think they should use strlen rather than sizeof.

New release

I need the change introduced in this commit a3e5384ca51d1307c0e6e4291ea73bd7dd7b0fdb. (PR: #10 )

It's in master but unfortunately there has not been a release since the change has been committed.

Is it planned to create a new release soon including this change?

error: 'Base64' was not declared in this scope for ESP8266

I've been using this lib and it works fine for the Arduino. I'm compiling for the esp8266
I'm running your example and this is the error

Base64Encode:32: error: 'Base64' was not declared in this scope
int encodedLength = Base64.encodedLength(inputStringLength);

Not sure what why the extern doesn't work.

Security Vulnerability when decoding

Security Vulnerability Report

Buffer Overflow Vulnerability in Base64Class::decodedLength Function

Description :

The Base64Class::decodedLength function in Base64.cpp is vulnerable to a buffer overflow attack. This vulnerability arises when an invalid Base64 string ending with more than two '=' characters is passed to the function. The function does not properly validate the input, which can lead to an artificially reduced result of decodedLength. This can subsequently allow an attacker to write data outside of the intended bounds when calling the decode function.

Affected Code :

Base64Class::decodedLength in src/Base64.cpp

int Base64Class::decodedLength(char * input, int inputLength) {
	int i = 0;
	int numEq = 0;
	for(i = inputLength - 1; input[i] == '='; i--) {
		numEq++;
	}

	return ((6 * inputLength) / 8) - numEq;
}

Impact

This vulnerability can lead to a buffer overflow, which is a critical security issue. Buffer overflows can allow an attacker to crash the program, alter program's results, or in the worst case, allow an attacker to execute arbitrary code.

error: 'Base64' was not declared in this scope

Running on an ESP32 and simply trying to compile the encode example however Base64 is not found in scope

error: 'Base64' was not declared in this scope

Base64.encodedLength(inputStringLength);

Regression moving to 1.0.0

Hello,

I moved from 0.0.1 to 1.0.0 and compiler started to complain about missing "pgmspace" on my Arduino MKRGSM 1400:

resolve error.The Base64 library encountered an unknown path resolve error.D*: 14:10: fatal error: pgmspace.h: No such file or directory
#include <pgmspace.h>
^~~~~~~~~~~~
compilation terminated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.