commit 27427f4f56df8166fc59d2475eee1322c7f07f87
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Jul 22 17:46:54 2012 +0200

    don't access free'd memory in cancel_sync()
    
    as it happens, the 1st round *may* trash svars - if we get the
    cancelation request after the slave store has already died.

 src/sync.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index f4315b3..865cd67 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -403,14 +403,17 @@ cancel_sync( sync_vars_t *svars )
 {
        int t;
 
-       /* the 1st round is guaranteed not to trash svars */
-       for (t = 0; t < 2; t++)
+       for (t = 0; t < 2; t++) {
+               int other_state = svars->state[1-t];
                if (svars->ret & SYNC_BAD(t)) {
                        svars->drv[t]->cancel_store( svars->ctx[t] );
                        cancel_done( AUX );
                } else {
                        svars->drv[t]->cancel( svars->ctx[t], cancel_done, AUX 
);
                }
+               if (other_state & ST_CANCELED)
+                       break;
+       }
 }
 
 static void

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to