Fix TypeError: 'NoneType' object is not callable in magic.close()

Resolves: RHEL-136523
This commit is contained in:
Vincent Mihalkovic 2026-01-28 11:19:15 +01:00
parent aec7b4223d
commit ddb3ff580d
2 changed files with 27 additions and 1 deletions

20
file-5.43-python.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/python/magic.py b/python/magic.py
index a528cbc..eb153b0 100644
--- a/python/magic.py
+++ b/python/magic.py
@@ -111,12 +111,14 @@ _errno.argtypes = [magic_t]
class Magic(object):
def __init__(self, ms):
self._magic_t = ms
+ self._close = _close
def close(self):
"""
Closes the magic database and deallocates any resources used.
"""
- _close(self._magic_t)
+ if self._close:
+ self._close(self._magic_t)
@staticmethod
def __tostr(s):

View File

@ -15,7 +15,7 @@
Summary: Utility for determining file types
Name: file
Version: 5.39
Release: 16%{?dist}
Release: 17%{?dist}
License: BSD
Source0: http://ftp.astron.com/pub/file/file-%{version}.tar.gz
@ -62,6 +62,8 @@ Patch16: file-5.39-wasm-magic.patch
Patch17: file-5.41-python-magic-threads.patch
# Upstream commit 497aabb29cd08d2a5aeb63e45798d65fcbe03502 (#5733)
Patch18: file-5.42-cve-strlcpy.patch
# Upstream commit 141dde1fe573e6c42800d12affb94c927b44da3e
Patch19: file-5.43-python.patch
URL: https://www.darwinsys.com/file/
Requires: file-libs%{?_isa} = %{version}-%{release}
@ -241,6 +243,10 @@ cd %{py3dir}
%endif
%changelog
* Mon Feb 23 2026 Vincent Mihalkovic <vmihalko@redhat.com> - 5.39-17
- Fix TypeError: 'NoneType' object is not callable in magic.close()
Resolves: RHEL-136523
* Thu Nov 23 2023 Vincent Mihalkovic <vmihalko@redhat.com> - 5.39-16
- Fix stack-based buffer over-read in file_copystr() (CVE-2022-48554)