diff --git a/.gitignore b/.gitignore index 8c5936d..f215809 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/sanlock-3.9.1.tar.gz +SOURCES/sanlock-3.9.3.tar.gz diff --git a/.sanlock.metadata b/.sanlock.metadata index 687c69f..93d4404 100644 --- a/.sanlock.metadata +++ b/.sanlock.metadata @@ -1 +1 @@ -ca8428d1be60cf92953b4aad4bf26802b9e7d266 SOURCES/sanlock-3.9.1.tar.gz +ad1db73afa4a6cd755b118c578d2b38b192f8f91 SOURCES/sanlock-3.9.3.tar.gz diff --git a/SOURCES/0001-sanlock-fix-invalid-strcpy-in-direct-dump.patch b/SOURCES/0001-sanlock-fix-invalid-strcpy-in-direct-dump.patch new file mode 100644 index 0000000..22eb98b --- /dev/null +++ b/SOURCES/0001-sanlock-fix-invalid-strcpy-in-direct-dump.patch @@ -0,0 +1,50 @@ +From 5b34da78d33c2fca7dc3d2c49ae6d395d90c48c1 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 14 Aug 2024 11:51:17 -0500 +Subject: [PATCH] sanlock: fix invalid strcpy in direct dump + +If a lockspace or resource name is the full 48 characters +in length, then the ondisk name field does not contain a +terminating null character and strcpy fails. +--- + src/direct.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/direct.c b/src/direct.c +index f70dc19d5ef2..3bc7659e905c 100644 +--- a/src/direct.c ++++ b/src/direct.c +@@ -730,8 +730,8 @@ int direct_dump(struct task *task, char *dump_path, int force_mode) + if (!lr->owner_id && !lr->owner_generation) + continue; + +- strcpy(sname, lr->space_name); +- strcpy(rname, lr->resource_name); ++ memcpy(sname, lr->space_name, NAME_ID_SIZE); ++ memcpy(rname, lr->resource_name, NAME_ID_SIZE); + + printf("%08llu %36s %48s %010llu %04llu %04llu", + (unsigned long long)(start_offset + ((sector_nr + i) * sector_size)), +@@ -754,8 +754,8 @@ int direct_dump(struct task *task, char *dump_path, int force_mode) + leader_record_in(lr_end, &lr_in); + lr = &lr_in; + +- strcpy(sname, lr->space_name); +- strcpy(rname, lr->resource_name); ++ memcpy(sname, lr->space_name, NAME_ID_SIZE); ++ memcpy(rname, lr->resource_name, NAME_ID_SIZE); + + printf("%08llu %36s %48s %010llu %04llu %04llu %llu", + (unsigned long long)(start_offset + (sector_nr * sector_size)), +@@ -806,7 +806,7 @@ int direct_dump(struct task *task, char *dump_path, int force_mode) + rindex_header_in(rh_end, &rh_in); + rh = &rh_in; + +- strcpy(sname, rh->lockspace_name); ++ memcpy(sname, rh->lockspace_name, NAME_ID_SIZE); + + printf("%08llu %36s rindex_header 0x%x %d %u %llu\n", + (unsigned long long)(start_offset + (sector_nr * sector_size)), +-- +2.46.0 + diff --git a/SPECS/sanlock.spec b/SPECS/sanlock.spec index 30efcda..158f2e7 100644 --- a/SPECS/sanlock.spec +++ b/SPECS/sanlock.spec @@ -1,6 +1,6 @@ Name: sanlock -Version: 3.9.1 -Release: 1%{?dist} +Version: 3.9.3 +Release: 2%{?dist} Summary: A shared storage lock manager License: GPLv2 and GPLv2+ and LGPLv2+ @@ -22,14 +22,14 @@ Requires(preun): systemd-units Requires(postun): systemd-units Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz -#Patch0: +Patch0: 0001-sanlock-fix-invalid-strcpy-in-direct-dump.patch %description The sanlock daemon manages leases for applications on hosts using shared storage. %prep %setup -q -#%patch0 -p1 -b .backup0 +%patch0 -p1 -b .backup0 %build %set_build_flags @@ -153,6 +153,12 @@ developing applications that use %{name}. %{_libdir}/pkgconfig/libsanlock_client.pc %changelog +* Wed Aug 14 2024 David Teigland - 3.9.3-2 +- fix invalid strcpy in direct dump + +* Wed May 15 2024 David Teigland - 3.9.3-1 +- upstream release + * Mon Jan 22 2024 David Teigland - 3.9.1-1 - upstream release, fix rpm issues