kristoiv / rijndael

This was a weekend project I did to learn about Cryptographic concepts. So it was solely implemented for learning purposes.
Other
0 stars 0 forks source link

bug for base64 #1

Open 5m1le71ger opened 9 years ago

5m1le71ger commented 9 years ago

in the function ' base64_decode', //////////////////////// char * str = new char[ret.size()]; strcpy(str, ret.c_str()); ///////////////////////

the strcpy is very DANGER, the alloc memory of str must add one as following:

    char * str = new char[ret.size() + 1];// for zero-end char

and, u must free the new memory ,at 恰当的时候

kristoiv commented 9 years ago

Interesting! I will have a look at it. Thanks for the tip 5m1le71ger.

kristoiv commented 9 years ago

(I hope you aren't using this for anything that is not educational, as it will be vulnerable to timing attacks and so on. This was just a fun and direct implementation of the theory in order to understand AES better :smile: )