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
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