On Tue, Jul 17, 2012 at 10:39:39PM -0400, Paul Wouters wrote:
> 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 "3" is actually "4-1", as the way to write ceil(x/4) in C (with
integer arithmetic) is (x+3)/4.
- Ian
_______________________________________________
OTR-dev mailing list
[email protected]
http://lists.cypherpunks.ca/mailman/listinfo/otr-dev