diff --git a/0029-use-realloc-instead-of-reallocarray.patch b/0029-use-realloc-instead-of-reallocarray.patch new file mode 100644 index 0000000000000000000000000000000000000000..f6022afb3ae64c8194181a9dbea956d3fb204792 --- /dev/null +++ b/0029-use-realloc-instead-of-reallocarray.patch @@ -0,0 +1,36 @@ +From d03dfb4e9523b4f8537a673727d252695c241745 Mon Sep 17 00:00:00 2001 +From: TIAN Yuanhao <78596099+tianyuanhao@users.noreply.github.com> +Date: Fri, 23 Sep 2022 00:33:33 +0800 +Subject: [PATCH] libopeniscsiusr: use realloc instead of reallocarray (#368) + +--- + libopeniscsiusr/session.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/libopeniscsiusr/session.c b/libopeniscsiusr/session.c +index 6b06241..4d47592 100644 +--- a/libopeniscsiusr/session.c ++++ b/libopeniscsiusr/session.c +@@ -289,9 +289,17 @@ int iscsi_sessions_get(struct iscsi_context *ctx, + rc = LIBISCSI_OK; + } + } +- /* reset session count and sessions array length to what we were able to read from sysfs */ ++ /* ++ * reset session count and sessions array length to what we were able to read from sysfs ++ * ++ * do not use reallocarray() for the sessions array, since not all platforms ++ * have that function call ++ */ + *session_count = j; +- *sessions = reallocarray(*sessions, *session_count, sizeof(struct iscsi_session *)); ++ /* assert that there is no integer overflow in the realloc call */ ++ assert(!(*session_count > (UINT_MAX / sizeof(struct iscsi_session *)))); ++ *sessions = ++ realloc(*sessions, *session_count * sizeof(struct iscsi_session *)); + + out: + free(sids); +-- +2.27.0 + diff --git a/open-iscsi.spec b/open-iscsi.spec index 74795297e96ea8cba9c3a4c8297d2bb327584cde..c75127f1d16bb91720c8e896b4ff1892736f9b7d 100644 --- a/open-iscsi.spec +++ b/open-iscsi.spec @@ -4,7 +4,7 @@ Name: open-iscsi Version: 2.1.5 -Release: 14 +Release: 15 Summary: ISCSI software initiator daemon and utility programs License: GPLv2+ and BSD URL: http://www.open-iscsi.com @@ -37,6 +37,7 @@ patch25: 0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch patch26: 0026-iscsid-clear-scanning-thread-s-PR_SET_IO_FLUSHER-fla.patch patch27: 0027-iscsid-stop-connection-for-recovery-if-error-is-not-.patch patch28: 0028-discoveryd-fix-format-overflow-warning-413.patch +patch29: 0029-use-realloc-instead-of-reallocarray.patch BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config @@ -163,6 +164,9 @@ fi %{_mandir}/man8/* %changelog +* Tue Apr 9 2024 yanshuai - 2.1.5-15 +- use realloc instead of reallocarray + * Tue Feb 20 2024 jiangjianjun - 2.1.5-14 - update open-iscsi.spec