libiscsi/0024-fix-segmentation-fault.patch
2024-09-06 06:23:38 +00:00

28 lines
986 B
Diff

From abedc1848cf6305f2c1f20078710755c66415d2d Mon Sep 17 00:00:00 2001
From: folkert van heusden <mail@vanheusden.com>
Date: Tue, 30 Jan 2024 15:33:20 +0100
Subject: [PATCH] Fix for https://github.com/sahlberg/libiscsi/issues/409
'ms->pages' was not checked for being NULL. This can happen when a target
does not return any pages.
---
test-tool/iscsi-support.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c
index 169d2b0..ea9f711 100644
--- a/test-tool/iscsi-support.c
+++ b/test-tool/iscsi-support.c
@@ -2740,7 +2740,7 @@ int set_swp(struct scsi_device *sdev)
logging(LOG_VERBOSE, "[SUCCESS] CONTROL page fetched.");
ms = scsi_datain_unmarshall(sense_task);
- if (ms == NULL) {
+ if (ms == NULL || ms->pages == NULL) {
logging(LOG_NORMAL, "failed to unmarshall mode sense datain "
"blob");
ret = -1;
--
2.27.0