Skip to content

Commit

Permalink
set minimum bufsize for base64 encode
Browse files Browse the repository at this point in the history
  • Loading branch information
matth-x authored and Links2004 committed Aug 19, 2023
1 parent 751cf87 commit 30d5e13
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/WebSockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ String WebSockets::acceptKey(String & clientKey) {
*/
String WebSockets::base64_encode(uint8_t * data, size_t length) {
size_t size = ((length * 1.6f) + 1);
size = std::max(size, (size_t) 5); //minimum buffer size
char * buffer = (char *)malloc(size);
if(buffer) {
base64_encodestate _state;
Expand Down

0 comments on commit 30d5e13

Please sign in to comment.