[Mauiusers] Patch to fix a possible double free

Stanislav Ievlev inger at altlinux.org
Fri Aug 10 05:36:14 MDT 2007


Greetings!

I've made a patch to fix a double free memory corruption (see in attach to
this message).

It's also another little problem.
Daemon should duplicate all standard
descriptors to /dev/null.

Current implementation doesn't make it:
--
#/usr/sbin/maui
# pidof maui
4336
# LANG=C ls -al /proc/4336/fd
total 11
dr-x------ 2 root  root   0 Aug 10 15:27 .
dr-xr-xr-x 5 _maui _maui  0 Aug 10 15:27 ..
lrwx------ 1 root  root  64 Aug 10 15:27 0 -> /dev/pts/3
lrwx------ 1 root  root  64 Aug 10 15:27 1 -> /dev/pts/3
lrwx------ 1 root  root  64 Aug 10 15:27 10 -> socket:[3922076]
lrwx------ 1 root  root  64 Aug 10 15:27 2 -> /dev/pts/3
lrwx------ 1 root  root  64 Aug 10 15:27 3 -> /var/spool/maui/log/maui.log
lr-x------ 1 root  root  64 Aug 10 15:27 4 -> /dev/null
lrwx------ 1 root  root  64 Aug 10 15:27 5 -> socket:[3922058]
lrwx------ 1 root  root  64 Aug 10 15:27 6 -> /var/spool/maui/stats/_2007
lrwx------ 1 root  root  64 Aug 10 15:27 7 -> socket:[3922065]
lrwx------ 1 root  root  64 Aug 10 15:27 8 -> socket:[3922066]
lrwx------ 1 root  root  64 Aug 10 15:27 9 -> socket:[3922067]
--

--
With best regards
Stanislav Ievlev.

-------------- next part --------------
diff -Naur maui.orig/src/moab/MStats.c maui/src/moab/MStats.c
--- maui.orig/src/moab/MStats.c	2007-03-29 00:05:39 +0400
+++ maui/src/moab/MStats.c	2007-08-10 15:24:32 +0400
@@ -2709,7 +2709,7 @@
 int MStatShutdown()
 
   {
-  if (MSched.statfp != NULL)
+  if ((MSched.statfp != NULL) && (MSched.statfp != mlog.logfp))
     {
     fclose(MSched.statfp);
  


More information about the mauiusers mailing list