From b4d1cd7907e4c53d79e868092ea0bb3ddd62f616 Mon Sep 17 00:00:00 2001 From: lishiao144 <1447175116@qq.com> Date: Wed, 28 May 2025 15:57:40 +0800 Subject: [PATCH 1/2] MAX_CHAP_R_SIZE updata --- include/iscsi-private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 6bd72a4..69781ef 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -98,7 +98,7 @@ struct iscsi_in_pdu { void iscsi_free_iscsi_in_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in); /* size of chap response field */ -#define MAX_CHAP_R_SIZE 20 /* md5:16 sha1:20 */ +#define MAX_CHAP_R_SIZE 32 /* md5:16 sha1:20 */ /* max length of chap challange */ #define MAX_CHAP_C_LENGTH 2048 From 7254f954ffed81d0a85b98ac6871cd2d7725eada Mon Sep 17 00:00:00 2001 From: lishiao144 <1447175116@qq.com> Date: Wed, 28 May 2025 15:59:27 +0800 Subject: [PATCH 2/2] zero-initialize target_chap_c to avoid relying on stack memory --- lib/login.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/login.c b/lib/login.c index 120c8c2..73a6d62 100644 --- a/lib/login.c +++ b/lib/login.c @@ -936,7 +936,7 @@ iscsi_login_add_chap_response(struct iscsi_context *iscsi, struct iscsi_pdu *pdu /* bidirectional chap */ if (iscsi->target_user[0]) { - char target_chap_c[MAX_CHAP_R_SIZE * 2]; + char target_chap_c[MAX_CHAP_R_SIZE * 2] = {0}; iscsi->target_chap_i++; snprintf(str, MAX_STRING_SIZE, "CHAP_I=%d",