From 4b133aac2ac18a99a032b56a40fc3eeafc8250f9 Mon Sep 17 00:00:00 2001 From: zhanghua1831 Date: Tue, 15 Sep 2020 17:13:49 +0800 Subject: [PATCH] fix CVE-2019-9755 --- CVE-2019-9755.patch | 46 +++++++++++++++++++++++++++++++++++++++++++++ ntfs-3g.spec | 11 +++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 CVE-2019-9755.patch diff --git a/CVE-2019-9755.patch b/CVE-2019-9755.patch new file mode 100644 index 0000000..d54f7e1 --- /dev/null +++ b/CVE-2019-9755.patch @@ -0,0 +1,46 @@ +diff -up ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c.CVE-2019-9755 ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c +--- ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c.CVE-2019-9755 2019-03-29 16:08:22.359920075 -0400 ++++ ntfs-3g_ntfsprogs-2017.3.23/src/lowntfs-3g.c 2019-03-29 16:08:28.237794169 -0400 +@@ -4323,7 +4323,8 @@ int main(int argc, char *argv[]) + else { + ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); + if (ctx->abs_mnt_point) { +- if (getcwd(ctx->abs_mnt_point, ++ if ((strlen(opts.mnt_point) < PATH_MAX) ++ && getcwd(ctx->abs_mnt_point, + PATH_MAX - strlen(opts.mnt_point) - 1)) { + strcat(ctx->abs_mnt_point, "/"); + strcat(ctx->abs_mnt_point, opts.mnt_point); +@@ -4331,6 +4332,9 @@ int main(int argc, char *argv[]) + /* Solaris also wants the absolute mount point */ + opts.mnt_point = ctx->abs_mnt_point; + #endif /* defined(__sun) && defined (__SVR4) */ ++ } else { ++ free(ctx->abs_mnt_point); ++ ctx->abs_mnt_point = (char*)NULL; + } + } + } +diff -up ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c.CVE-2019-9755 ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c +--- ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c.CVE-2019-9755 2019-03-29 16:08:54.691227528 -0400 ++++ ntfs-3g_ntfsprogs-2017.3.23/src/ntfs-3g.c 2019-03-29 16:09:40.362249397 -0400 +@@ -4123,7 +4123,8 @@ int main(int argc, char *argv[]) + else { + ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX); + if (ctx->abs_mnt_point) { +- if (getcwd(ctx->abs_mnt_point, ++ if ((strlen(opts.mnt_point) < PATH_MAX) ++ && getcwd(ctx->abs_mnt_point, + PATH_MAX - strlen(opts.mnt_point) - 1)) { + strcat(ctx->abs_mnt_point, "/"); + strcat(ctx->abs_mnt_point, opts.mnt_point); +@@ -4131,6 +4132,9 @@ int main(int argc, char *argv[]) + /* Solaris also wants the absolute mount point */ + opts.mnt_point = ctx->abs_mnt_point; + #endif /* defined(__sun) && defined (__SVR4) */ ++ } else { ++ free(ctx->abs_mnt_point); ++ ctx->abs_mnt_point = (char*)NULL; + } + } + } diff --git a/ntfs-3g.spec b/ntfs-3g.spec index d9f4edd..ca74e2c 100644 --- a/ntfs-3g.spec +++ b/ntfs-3g.spec @@ -1,6 +1,6 @@ Name: ntfs-3g Version: 2017.3.23 -Release: 10 +Release: 11 Epoch: 2 Summary: Linux NTFS userspace driver License: GPLv2+ @@ -10,7 +10,7 @@ Patch0: 0000-ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.p Patch1: 0001-check-mftmirr.patch Patch2: 0002-ntfs-3g-big-sectors.patch Patch3: 0003-ntfsclone-full-clusters-bz1601146.patch - +Patch4: CVE-2019-9755.patch BuildRequires: libtool, libattr-devel, libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel Provides: ntfsprogs-fuse = %{epoch}:%{version}-%{release} Obsoletes: ntfsprogs-fuse @@ -48,6 +48,7 @@ This package includes man files for %{name}. %patch1 -p0 -b .check-mftmirr %patch2 -p0 -b .big-sectors %patch3 -p0 -b .ntfsclone +%patch4 -p1 %build CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" @@ -95,5 +96,11 @@ rm -rf $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}/README %{_mandir}/man*/* %changelog +* Tue Sep 8 2020 zhanghua - 2:2017.3.23-11 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:fix CVE-2019-9755 + * Fri Dec 13 2019 openEuler Buildteam - 2:2017.3.23-10 - Package init -- Gitee