rpms/libdaemon/devel libdaemon-0.11-stdarg-fix.patch, NONE, 1.1 libdaemon.spec, 1.10, 1.11

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Mon Jul 2 19:05:07 UTC 2007


Author: dcbw

Update of /cvs/extras/rpms/libdaemon/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30011

Modified Files:
	libdaemon.spec 
Added Files:
	libdaemon-0.11-stdarg-fix.patch 
Log Message:
* Mon Jul  2 2007 Dan Williams <dcbw at redhat.com> - 0.11-2
- Fix double-free bug when closing daemon file descriptor (avahi.org #148)


libdaemon-0.11-stdarg-fix.patch:

--- NEW FILE libdaemon-0.11-stdarg-fix.patch ---
--- libdaemon-0.11/libdaemon/dfork.c.debug	2007-06-11 11:36:11.000000000 -0400
+++ libdaemon-0.11/libdaemon/dfork.c	2007-07-02 14:49:35.000000000 -0400
@@ -354,31 +354,38 @@
 
 int daemon_close_all(int except_fd, ...) {
     va_list original_ap, ap;
-    int n, i, r;
-    int *p;
+    int n = 0, i = 0, r = -1;
+    int *p = NULL;
 
-    va_start(original_ap, except_fd);
-    va_copy(ap, original_ap);
+    if (except_fd >= 0) {
+      va_start(original_ap, except_fd);
+      va_copy(ap, original_ap);
 
-    for (n = 0; va_arg(ap, int) >= 0; n++)
-        ;
+      for (n = 0; va_arg(ap, int) >= 0; n++)
+          ;
 
-    va_end(ap);
-
-    if (!(p = malloc(sizeof(int) * (n+1)))) {
-        va_end(original_ap);
-        return -1;
+      va_end(ap);
     }
 
-    i = 0;
-    while ((p[i++] = va_arg(original_ap, int)) >= 0)
-        ;
+    if (!(p = malloc(sizeof(int) * (n+2))))
+        goto out;
+
+    p[i++] = except_fd;
+
+    if (except_fd >= 0) {
+      i = 1;
+      while ((p[i++] = va_arg(original_ap, int)) >= 0)
+          ;
+    }
 
     p[i] = -1;
     
     r = daemon_close_allv(p);
+
+out:
+    if (except_fd >= 0)
+        va_end(original_ap);
     free(p);
-    
     return r;
 }
 


Index: libdaemon.spec
===================================================================
RCS file: /cvs/extras/rpms/libdaemon/devel/libdaemon.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- libdaemon.spec	22 Jun 2007 21:03:11 -0000	1.10
+++ libdaemon.spec	2 Jul 2007 19:04:30 -0000	1.11
@@ -1,6 +1,6 @@
 Name: libdaemon
 Version: 0.11
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: library for writing UNIX daemons
 
 Group: System Environment/Libraries
@@ -8,6 +8,7 @@
 URL: http://www.stud.uni-hamburg.de/users/lennart/projects/libdaemon
 Source0: %{name}-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0: libdaemon-0.11-stdarg-fix.patch
 
 # Requires lynx to build the docs
 BuildRequires:  lynx
@@ -36,6 +37,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .stdarg-fix
 
 %build
 %configure --disable-static
@@ -68,8 +70,11 @@
 %{_libdir}/pkgconfig/*.pc
 
 %changelog
+* Mon Jul  2 2007 Dan Williams <dcbw at redhat.com> - 0.11-2
+- Fix double-free bug when closing daemon file descriptor (avahi.org #148)
+
 * Fri Jun 22 2007 Martin Bacovsky <mbacovsk at redhat.com> - 0.11-1
-- update no new upstream version 0.11
+- Upgrade to new upstream version 0.11
 
 * Thu Apr  5 2007 Martin Bacovsky <mbacovsk at redhat.com> - 0.10-4
 - Resolves: #222855: fileconflict for /usr/share/doc/libdaemon-devel-0.10/Makefile 




More information about the fedora-extras-commits mailing list