diff options
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 164b87138faf..de77d9aa22c6 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -146,6 +146,7 @@ static int chap_server_compute_md5( | |||
146 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; | 146 | unsigned char client_digest[MD5_SIGNATURE_SIZE]; |
147 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; | 147 | unsigned char server_digest[MD5_SIGNATURE_SIZE]; |
148 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; | 148 | unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; |
149 | size_t compare_len; | ||
149 | struct iscsi_chap *chap = conn->auth_protocol; | 150 | struct iscsi_chap *chap = conn->auth_protocol; |
150 | struct crypto_hash *tfm; | 151 | struct crypto_hash *tfm; |
151 | struct hash_desc desc; | 152 | struct hash_desc desc; |
@@ -184,7 +185,9 @@ static int chap_server_compute_md5( | |||
184 | goto out; | 185 | goto out; |
185 | } | 186 | } |
186 | 187 | ||
187 | if (memcmp(chap_n, auth->userid, strlen(auth->userid)) != 0) { | 188 | /* Include the terminating NULL in the compare */ |
189 | compare_len = strlen(auth->userid) + 1; | ||
190 | if (strncmp(chap_n, auth->userid, compare_len) != 0) { | ||
188 | pr_err("CHAP_N values do not match!\n"); | 191 | pr_err("CHAP_N values do not match!\n"); |
189 | goto out; | 192 | goto out; |
190 | } | 193 | } |