commit 833fae19709871397c7749b46fef3977375f0669
Author: Andrea Musuruane <musuruan(a)gmail.com>
Date: Sat Mar 20 16:43:34 2021 +0100
Fix core dump (BZ #5938)
Fix leaked sockets by correctly initialising the ev struct
minidlna-1.3.0-fd-leak.patch | 28 ++++++++++++++++++++++++++++
minidlna-1.3.0-select_use_after_free.patch | 12 ++++++++++++
minidlna.spec | 13 ++++++++++++-
3 files changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/minidlna-1.3.0-fd-leak.patch b/minidlna-1.3.0-fd-leak.patch
new file mode 100644
index 0000000..eec2bcd
--- /dev/null
+++ b/minidlna-1.3.0-fd-leak.patch
@@ -0,0 +1,28 @@
+diff --git a/upnpevents.c b/upnpevents.c
+index 4de6ce8..1126fa7 100644
+--- a/upnpevents.c
++++ b/upnpevents.c
+@@ -290,18 +290,17 @@ upnp_event_create_notify(struct subscriber *sub)
+ addr.sin_family = AF_INET;
+ inet_aton(obj->addrstr, &addr.sin_addr);
+ addr.sin_port = htons(port);
+- DPRINTF(E_DEBUG, L_HTTP, "%s: '%s' %hu '%s'\n",
"upnp_event_notify_connect",
++ DPRINTF(E_DEBUG, L_HTTP, "%s: '%s' %hu '%s'\n",
"upnp_event_create_notify",
+ obj->addrstr, port, obj->path);
+ obj->state = EConnecting;
++ obj->ev = (struct event ){ .fd = s, .rdwr = EVENT_WRITE,
++ .process = upnp_event_process_notify, .data = obj };
++ event_module.add(&obj->ev);
+ if(connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+ if(errno != EINPROGRESS && errno != EWOULDBLOCK) {
+- DPRINTF(E_ERROR, L_HTTP, "%s: connect(): %s\n",
"upnp_event_notify_connect", strerror(errno));
++ DPRINTF(E_ERROR, L_HTTP, "%s: connect(): %s\n",
"upnp_event_create_notify", strerror(errno));
+ obj->state = EError;
+ }
+- } else {
+- obj->ev = (struct event ){ .fd = s, .rdwr = EVENT_WRITE,
+- .process = upnp_event_process_notify, .data = obj };
+- event_module.add(&obj->ev);
+ }
+
+ return;
diff --git a/minidlna-1.3.0-select_use_after_free.patch
b/minidlna-1.3.0-select_use_after_free.patch
new file mode 100644
index 0000000..6a29b08
--- /dev/null
+++ b/minidlna-1.3.0-select_use_after_free.patch
@@ -0,0 +1,12 @@
+fix potential use-after-free in child process
+diff -wpruN '--exclude=*.orig' a~/select.c a/select.c
+--- a~/select.c 1970-01-01 00:00:00
++++ a/select.c 1970-01-01 00:00:00
+@@ -83,6 +83,7 @@ select_fini(void)
+
+ free(events);
+ events = NULL;
++ nevents = 0;
+ }
+
+ static int
diff --git a/minidlna.spec b/minidlna.spec
index a07e1a4..1c3d012 100644
--- a/minidlna.spec
+++ b/minidlna.spec
@@ -1,7 +1,8 @@
%global _lto_cflags %{nil}
+
Name: minidlna
Version: 1.3.0
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Lightweight DLNA/UPnP-AV server targeted at embedded systems
License: GPLv2
@@ -14,6 +15,12 @@ Source2: %{name}-tmpfiles.conf
# Fix compiling with -fno-common
#
https://sourceforge.net/p/minidlna/bugs/332/
Patch0: %{name}-1.3.0-fno-common.patch
+# Fix core dump
+#
https://sourceforge.net/p/minidlna/bugs/333/
+Patch1: %{name}-1.3.0-select_use_after_free.patch
+# Fix leaked sockets by correctly initialising the ev struct
+#
https://bugs.gentoo.org/768030
+Patch2: %{name}-1.3.0-fd-leak.patch
BuildRequires: make
BuildRequires: gcc
@@ -127,6 +134,10 @@ exit 0
%changelog
+* Sat Mar 20 2021 Andrea Musuruane <musuruan(a)gmail.com> - 1.3.0-4
+- Fix core dump (BZ #5938)
+- Fix leaked sockets by correctly initialising the ev struct
+
* Wed Feb 03 2021 RPM Fusion Release Engineering <leigh123linux(a)gmail.com> -
1.3.0-3
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild