On 16 Sep (20:33:27), k007k wrote:
> Hi all,
> 
> While debugging my plugin, I came across the following code in context.c:
> 
> /* Forget a whole context, so long as it's PLAINTEXT. If a context has child
>  * instances, don't remove this instance unless children are also all in
>  * PLAINTEXT state. In this case, the children will also be removed.
>  * Returns 0 on success, 1 on failure. */
> int otrl_context_forget(ConnContext *context)
> {
>     if (context->msgstate != OTRL_MSGSTATE_PLAINTEXT) return 1;
> 
>     if (context->their_instance == OTRL_INSTAG_MASTER) {
>         ConnContext *c_iter;
> 
>         for (c_iter = context; c_iter &&
>                 c_iter->m_context == context->m_context;
>                 c_iter = c_iter->next) {
>             if (context->msgstate != OTRL_MSGSTATE_PLAINTEXT) return 1;
>         }
> (...)
> 
> I think the last if statement should check c_iter->msgstate instead of 
> context->msgstate.

I think you are absolutely right here. Does not make sense to check the
context object again in that loop especially since it's not changing.

I just opened a ticket, see https://bugs.otr.im/issues/53 and attached
your proposed patch.

Thanks!
David

> 
> Regards,
> Konrad
> _______________________________________________
> OTR-dev mailing list
> OTR-dev@lists.cypherpunks.ca
> http://lists.cypherpunks.ca/mailman/listinfo/otr-dev

Attachment: signature.asc
Description: Digital signature

_______________________________________________
OTR-dev mailing list
OTR-dev@lists.cypherpunks.ca
http://lists.cypherpunks.ca/mailman/listinfo/otr-dev

Reply via email to