diff --git a/Changelog b/Changelog index 591651b..80a4a9d 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Version 0.4: ============= 2026-04-17: - adding function to request a certain headline +- base64decode increase the outputbuffer by 2 bytes for null-temrinated strings 2026-04-16: - base64encode and base64decode implemented diff --git a/ssl.cc b/ssl.cc index d81bb67..d859dc0 100644 --- a/ssl.cc +++ b/ssl.cc @@ -463,7 +463,7 @@ int base64decode(std::string input, char **obuffer, int *olen) { // calculate and realloc size of buffer if (*obuffer == NULL || (1 + ilen*3/4) < *olen) { - *olen = 1 + ilen*3/4; + *olen = 2 + ilen*3/4; // increase buffer by two ... null terminated string? *obuffer = (char*) realloc(*obuffer, *olen); } @@ -493,6 +493,7 @@ int base64decode(std::string input, char **obuffer, int *olen) { (*obuffer)[ocnt++] = c; } *olen = ocnt; + (*obuffer)[ocnt] = 0; // nullterminate - just to prevent unseen stuff return 1; };