From bb4602a1cbef7c37ee2318edb1e26ce1203ae51f Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Wed, 21 Aug 2024 14:02:54 +0200 Subject: [PATCH] Prevent a file descriptor leak Resolves: RHEL-44911 --- mtools-4.0.43-close.patch | 11 +++++++++++ mtools.spec | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 mtools-4.0.43-close.patch diff --git a/mtools-4.0.43-close.patch b/mtools-4.0.43-close.patch new file mode 100644 index 0000000..df37982 --- /dev/null +++ b/mtools-4.0.43-close.patch @@ -0,0 +1,11 @@ +diff -ur mtools-4.0.44/mpartition.c mtools-4.0.44-memleaks/mpartition.c +--- mtools-4.0.44/mpartition.c 2022-10-29 11:48:23.000000000 +0200 ++++ mtools-4.0.44-memleaks/mpartition.c 2024-08-21 13:53:03.699524744 +0200 +@@ -483,6 +483,7 @@ + perror("read MBR"); + exit(1); + } ++ close(fd); + } + memset((char *)(partTable+1), 0, 4*sizeof(*partTable)); + set_word(((unsigned char*)buf)+510, 0xaa55); diff --git a/mtools.spec b/mtools.spec index 86db80c..c598571 100644 --- a/mtools.spec +++ b/mtools.spec @@ -8,6 +8,7 @@ Url: https://www.gnu.org/software/mtools/ Patch0: mtools-3.9.6-config.patch Patch1: mtools-4.0.43-errmsgsize.patch Patch2: mtools-4.0.43-iconv_close.patch +Patch3: mtools-4.0.43-close.patch BuildRequires: make BuildRequires: gcc @@ -35,6 +36,7 @@ Mtools should be installed if you need to use MS-DOS disks %patch 0 -p1 -b .conf %patch 1 -p1 %patch 2 -p1 +%patch 3 -p1 %build autoreconf -fiv