diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c
index 4c183602ee896315f0b0b1aee9466328d6d25390..d71fec74ad044f4ae7a4397303232c7f76d7c473 100644
--- a/libraries/libldap/tls_m.c
+++ b/libraries/libldap/tls_m.c
@@ -624,7 +624,7 @@ nss_parse_ciphers(const char *cipherstr, int cipher_list[ciphernum])
 			} else {
 				for (i=0; i<ciphernum; i++) {
 					if (!strcmp(ciphers_def[i].ossl_name, cipher) &&
-						cipher_list[1] != -1)
+						cipher_list[i] != -1)
 						cipher_list[i] = action;
 				}
 			}