diff --git a/0052-append_pathname-check-the-value-returned-by-realloc.patch b/0052-append_pathname-check-the-value-returned-by-realloc.patch new file mode 100644 index 0000000000000000000000000000000000000000..26d740d87e5c748eede78b43c95472aa5da04e48 --- /dev/null +++ b/0052-append_pathname-check-the-value-returned-by-realloc.patch @@ -0,0 +1,46 @@ +From af03924f5b43b325a436d07ee1222f42e3aa96b6 Mon Sep 17 00:00:00 2001 +From: wuguanghao +Date: Wed, 30 Jun 2021 16:27:18 +0800 +Subject: [PATCH] append_pathname: check the value returned by realloc + +In append_pathname(), we need to add a new path to save the value +returned by realloc, otherwise the name->path may be NULL, causing +a segfault. + +Signed-off-by: Wu Guanghao +Signed-off-by: Zhiqiang Liu +Signed-off-by: Theodore Ts'o +--- + contrib/fsstress.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/contrib/fsstress.c b/contrib/fsstress.c +index 2a983482..2136a903 100644 +--- a/contrib/fsstress.c ++++ b/contrib/fsstress.c +@@ -599,6 +599,7 @@ void add_to_flist(int ft, int id, int parent) + void append_pathname(pathname_t * name, char *str) + { + int len; ++ char *path; + + len = strlen(str); + #ifdef DEBUG +@@ -609,7 +610,13 @@ void append_pathname(pathname_t * name, char *str) + + } + #endif +- name->path = realloc(name->path, name->len + 1 + len); ++ path = realloc(name->path, name->len + 1 + len); ++ if (path == NULL) { ++ fprintf(stderr, "fsstress: append_pathname realloc failed\n"); ++ chdir(homedir); ++ abort(); ++ } ++ name->path = path; + strcpy(&name->path[name->len], str); + name->len += len; + } +-- +2.33.0 + diff --git a/0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch b/0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c8177298b14c5832f46d94218bcd41846a1cce6 --- /dev/null +++ b/0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch @@ -0,0 +1,31 @@ +From a61bc9e009b4b829f61f1717753b4ee0882d9aba Mon Sep 17 00:00:00 2001 +From: Zhiqiang Liu +Date: Wed, 30 Jun 2021 16:27:19 +0800 +Subject: [PATCH] argv_parse: check return value of malloc in argv_parse() + +In argv_parse(), return value of malloc should be checked +whether it is NULL, otherwise, it may cause a segfault error. + +Signed-off-by: Zhiqiang Liu +Signed-off-by: Wu Guanghao +Signed-off-by: Theodore Ts'o +--- + lib/support/argv_parse.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/support/argv_parse.c b/lib/support/argv_parse.c +index d22f6344..1f50f9e5 100644 +--- a/lib/support/argv_parse.c ++++ b/lib/support/argv_parse.c +@@ -116,6 +116,8 @@ int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv) + if (argv == 0) { + argv = malloc(sizeof(char *)); + free(buf); ++ if (!argv) ++ return -1; + } + argv[argc] = 0; + if (ret_argc) +-- +2.33.0 + diff --git a/e2fsprogs.spec b/e2fsprogs.spec index 7ce458d7328a08e8a673162f030c0e0d104580e7..2d496b01c23d458d5fb4521963ecf5f158da3d38 100644 --- a/e2fsprogs.spec +++ b/e2fsprogs.spec @@ -1,6 +1,6 @@ Name: e2fsprogs Version: 1.45.6 -Release: 17 +Release: 18 Summary: Second extended file system management tools License: GPLv2 and LGPLv2 and GPLv2+ URL: http://e2fsprogs.sourceforge.net/ @@ -58,6 +58,8 @@ Patch48: 0048-tune2fs-exit-directly-when-fs-freed-in-ext2fs_run_ext3_journal.pat Patch49: 0049-debugfs-fix-repeated-output-problem-with-logdump-O-n.patch Patch50: 0050-mmp-fix-wrong-comparison-in-ext2fs_mmp_stop.patch Patch51: 0051-misc-fsck.c-Processes-may-kill-other-processes.patch +Patch52: 0052-append_pathname-check-the-value-returned-by-realloc.patch +Patch53: 0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch BuildRequires: gcc pkgconfig texinfo BuildRequires: fuse-devel libblkid-devel libuuid-devel @@ -179,6 +181,9 @@ exit 0 %{_mandir}/man8/* %changelog +* Fri Apr 14 tangyuchen - 1.45.6-18 +- backport 2 patches + * Fri Mar 31 2023 Zhiqiang Liu - 1.45.6-17 - fix version error in changelog