[tpop3d-discuss]Segv when a maildir mailbox doesnt exist

Simon Loader simon at surf.org.uk
Tue, 27 Jul 2004 17:44:48 +0100


For simplicity we dont create a mailbox when a user does not exist.
Older versions of tpop3d always didnt care 1.5.3 does.

This is a patch I did to fix this :-

its just a check around unlock. (if you want a backtrace please holla)


--- maildir.c.orig      2004-07-27 17:37:50.000000000 +0100
+++ maildir.c   2004-07-27 17:39:27.000000000 +0100
@@ -110,10 +110,12 @@
  * Remove any .poplock lock directory in DIRECTORY. */
 static void maildir_unlock(const char *dirname) {
     char *lockdirname;
-    lockdirname = xmalloc(strlen(dirname) + sizeof("/.poplock"));
-    sprintf(lockdirname, "%s/.poplock", dirname);
-    rmdir(lockdirname); /* Nothing we can do if this fails. */
-    xfree(lockdirname);
+    if (dirname != NULL ) {
+           lockdirname = xmalloc(strlen(dirname) +
sizeof("/.poplock"));
+           sprintf(lockdirname, "%s/.poplock", dirname);
+        rmdir(lockdirname); /* Nothing we can do if this fails. */
+           xfree(lockdirname);
+    }
 }



-- 
Simon Loader