This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master in repository sanlock.
The following commit(s) were added to refs/heads/master by this push: new 93a24a4 sanlock: fix invalid strcpy in direct dump 93a24a4 is described below
commit 93a24a45f617acee76f1d19c1c3e40fc3be06677 Author: David Teigland teigland@redhat.com AuthorDate: Wed Aug 14 11:51:17 2024 -0500
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 f70dc19..3bc7659 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)),
sanlock-devel@lists.fedorahosted.org