adamvr / arduino-base64

A base64 library for the arduino platform, written in C
MIT License
184 stars 102 forks source link

corrected string lengths in example code #23

Open palto42 opened 6 years ago

palto42 commented 6 years ago

The encode and decode length must not include the terminating \0 of the string and the length of the output char array must be 1 larger for the \0 added at the end. The first point caused incorrect encoding and the second caused an overwrite of the first char of the input string. I validated the encoding of "Hello world" on Ubuntu CLI using echo -n 'Hello world' | base64

sebastienvermeille commented 5 months ago

I had the same issue with a special char appended when I decoded message encoded with this library.

Using the changes of this PR it works like a charm thank you @palto42