[OTR-dev] otrl_base64_otr_decode() function...
Paul Wouters
paul at cypherpunks.ca
Tue Jul 17 22:39:39 EDT 2012
On Tue, 17 Jul 2012, Ian Goldberg wrote:
> @@ -237,7 +237,7 @@ int otrl_base64_otr_decode(const char *msg, unsigned char **
> }
>
> /* Base64-decode the message */
> - rawlen = ((msglen-5) / 4) * 3; /* maximum possible */
> + rawlen = ((msglen-5+3) / 4) * 3; /* maximum possible */
> rawmsg = malloc(rawlen);
> if (!rawmsg && rawlen > 0) {
> return -1;
Personally, I prefer things like sizeof("===") over literals like '3'.
The compile will result in the same code, but the readability to new
coders will be much better. The above lines now look full of magic.
Paul
More information about the OTR-dev
mailing list