From 21d89cbf72c3efb6b7615da0462b3337db3923a6 Mon Sep 17 00:00:00 2001 From: liuh Date: Tue, 30 Sep 2025 16:37:33 +0800 Subject: [PATCH] btrfs-progs: image: fix the bug that filename sanitization not working --- ...e-fix-the-bug-that-filename-sanitiza.patch | 39 +++++++++++++++++++ btrfs-progs.spec | 6 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch diff --git a/0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch b/0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch new file mode 100644 index 0000000..aa7f913 --- /dev/null +++ b/0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch @@ -0,0 +1,39 @@ +From b6cafffa6138cb4f9f4f5d8d040ae623e96550a5 Mon Sep 17 00:00:00 2001 +From: liuh +Date: Tue, 30 Sep 2025 16:29:59 +0800 +Subject: [PATCH] btrfs-progs: image: fix the bug that filename sanitization + not working + +--- + image/sanitize.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/image/sanitize.c b/image/sanitize.c +index 084da22..ef4f6e5 100644 +--- a/image/sanitize.c ++++ b/image/sanitize.c +@@ -449,6 +449,8 @@ void sanitize_name(enum sanitize_mode sanitize, struct rb_root *name_tree, + int slot) + { + struct extent_buffer *eb; ++ u32 item_ptr_off = btrfs_item_ptr_offset(src, slot); ++ u32 item_ptr_size = btrfs_item_size(src, slot); + + eb = alloc_dummy_eb(src->start, src->len); + if (!eb) { +@@ -476,7 +478,11 @@ void sanitize_name(enum sanitize_mode sanitize, struct rb_root *name_tree, + break; + } + +- memcpy(dst, eb->data, eb->len); ++ /* ++ * Only overwrite the sanitized part, or we can overwrite previous ++ * sanitized value with the old values from @src. ++ */ ++ memcpy(dst + item_ptr_off, eb->data + item_ptr_off, item_ptr_size); + free(eb); + } + +-- +2.43.0 + diff --git a/btrfs-progs.spec b/btrfs-progs.spec index 800f1a6..d7a7c1e 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -1,6 +1,6 @@ Name: btrfs-progs Version: 6.6.3 -Release: 14 +Release: 15 Summary: btrfs userspace programs License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT URL: https://btrfs.wiki.kernel.org/index.php/Main_Page @@ -19,6 +19,7 @@ Patch0010: 0010-btrfs-progs-fix-the-conflicting-super-block-flags.patch Patch0011: 0011-btrfs-progs-convert-for-ext2-fix-possible-tree-check.patch Patch0012: 0012-btrfs-progs-convert-insert-a-dummy-inode-item-before.patch Patch0013: 0013-btrfs-progs-corrupt-block-fix-memory-leak-in-debug_c.patch +Patch0014: 0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch BuildRequires: python3-devel >= 3.4 BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel @@ -84,6 +85,9 @@ make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir %{_mandir}/man8/*.gz %changelog +* Tue Sep 30 2025 liuh - 6.6.3-15 +- btrfs-progs: image: fix the bug that filename sanitization not working + * Tue Jul 1 2025 wangmian - 6.6.3-14 - Fixed bug for macros in Changelog -- Gitee