[OTR-dev] otrl_base64_otr_decode() function...

Ian Goldberg ian at cypherpunks.ca
Thu Jul 19 11:46:27 EDT 2012


On Thu, Jul 19, 2012 at 11:37:47AM -0400, Paul Wouters wrote:
> On Thu, 19 Jul 2012, Ian Goldberg wrote:
> 
> >How's this for a proposed patch?  [Paul, I think this addresses your
> >"magic numbers" concern as well.]
> 
> It does, though I would have written:
> 
> >+    /* Skip over the "?OTR:" */
> >+    otrtag += 5;
> >+    msglen -= 5;
> 
> 	otrtag += sizeof("?OTR:")
> 	msglen -= sizeof("?OTR:")
> 
> Then you don't even need the comment :)

But sizeof("?OTR:") is *6*, not 5, because of the NUL terminator.  You
could use strlen() there, but I'm unconvinced about compilers
consistently optimizing away library calls.

   - Ian



More information about the OTR-dev mailing list