diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp
index cf7749a523de5aed4ad82c8b5d506426e9b43278..9e9aed149c0368ce2c8a3e48172014676f594235 100644
--- a/sflphone-common/src/sip/sdp.cpp
+++ b/sflphone-common/src/sip/sdp.cpp
@@ -706,7 +706,7 @@ void Sdp::get_remote_sdp_crypto_from_offer (const pjmedia_sdp_session* remote_sd
 	// iterate over all attribute for this media
         for(j = 0; j < attr_count; j++) {
 
-	    attribute = media->attr[i];
+	    attribute = media->attr[j];
 
 	    // test if this attribute is a crypto
 	    if (pj_stricmp2 (&attribute->name, "crypto") == 0) {