diff --git a/0004-logging-fix-segfault-on-an-underflow-with-an-input-s.patch b/0004-logging-fix-segfault-on-an-underflow-with-an-input-s.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b0a6d867868d005d98b9b5c28e4c2b9cc5be72c --- /dev/null +++ b/0004-logging-fix-segfault-on-an-underflow-with-an-input-s.patch @@ -0,0 +1,48 @@ +From 9cd8358cda919ae684d544ae05d80edcd597379c Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Mon, 25 Mar 2024 12:27:08 -0700 +Subject: [PATCH] logging: fix segfault on an underflow with an input string of + all newlines + +sanitize_format would segfault if the input string to a logging macro +was all newline characters, these minor changes to tracking length while +removing trailing newlines should resolve that. + +Signed-off-by: Chris Leech + +Conflict: NA +Reference: https://github.com/open-iscsi/open-isns/commit/9cd8358cda919ae684d544ae05d80edcd597379c +--- + logging.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/logging.c b/logging.c +index 25390bc..889750d 100644 +--- a/logging.c ++++ b/logging.c +@@ -46,13 +46,17 @@ sanitize_format(const char *fmt) + return fmt; + + strcpy(__fmt, fmt); +- while (len-- && __fmt[len] == '\n') +- __fmt[len] = '\0'; +- +- while (len) { ++ while (len > 0) { ++ len = len - 1; ++ if (__fmt[len] == '\n') ++ __fmt[len] = '\0'; ++ else ++ break; ++ } ++ while (len > 0) { ++ len = len - 1; + if (__fmt[len] == '\n') + __fmt[len] = ' '; +- --len; + } + + return __fmt; +-- +2.33.0 + diff --git a/open-isns.spec b/open-isns.spec index 64a3a681a9f2b5cc48ff44d5be482423b0f5acbf..c55cb69f068454412df1c0e0bc8928e2baf1f55f 100644 --- a/open-isns.spec +++ b/open-isns.spec @@ -1,6 +1,6 @@ Name: open-isns Version: 0.101 -Release: 4 +Release: 5 Summary: The iSNS server and client programs License: LGPLv2+ URL: https://www.github.com/open-iscsi/open-isns @@ -9,6 +9,7 @@ Source0: https://www.github.com/open-iscsi/open-isns/archive/v%{version}. Patch0001: 0001-Do-not-install-isnsd.socket-in-isnsd.service.patch Patch0002: 0002-isnsadm-Fix-unparse-command-line-options-V-and-r.patch Patch0003: 0003-isnsd-socket-Make-sure-to-create-IPv6-socket-default.patch +Patch0004: 0004-logging-fix-segfault-on-an-underflow-with-an-input-s.patch BuildRequires: gcc systemd automake autoconf make BuildRequires: openssl-devel systemd-devel @@ -96,6 +97,9 @@ install -p -m 644 isnsd.service %{buildroot}%{_unitdir}/isnsd.service %{_mandir}/man8/* %changelog +* Fri May 9 2025 lvyy - 0.101-5 +- logging: fix segfault on an underflow with an input string of all newlines + * Wed Jul 31 2024 JiangJianJun - 0.101-4 - DESC: fix spec format