mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-22 21:21:28 +00:00
iscsi-scst: Fix wrong variable in chap_calc_digest_af_alg memcpy
Use 'bytes' (the return value from af_alg_final) instead of 'res' (which is 0 after the last successful af_alg_update call) when copying the digest. This bug caused the memcpy to copy 0 bytes, resulting in an uninitialized digest buffer. It also triggered a GCC -Werror=stringop-overflow warning because 'res' could theoretically be negative, leading to a huge unsigned size.
This commit is contained in:
committed by
Gleb Chesnokov
parent
a2add2daa3
commit
6c6e7251b2
@@ -380,7 +380,7 @@ chap_calc_digest_af_alg(char *alg, char chap_id,
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(digest, buffer, MIN(res, digest_len));
|
||||
memcpy(digest, buffer, MIN(bytes, digest_len));
|
||||
|
||||
out:
|
||||
close(datafd);
|
||||
|
||||
Reference in New Issue
Block a user