--- vdelivermail.c.orig Thu Oct 10 14:35:47 2002
+++ vdelivermail.c      Thu Oct 10 14:38:25 2002
@@ -853,9 +853,12 @@
 char *maildir_to_email(char *maildir)
 {
  static char email[256];
- int i, j=0;
+ int i, j=0, length_domain_dir;
  char *pnt, *last;

+    /*  Added to get the right length for DOMAINS_DIR to strip the domain name */
+    length_domain_dir = strlen(DOMAINS_DIR)+2;
+
     memset(email, 0, sizeof(email));
     for(last=NULL, pnt=maildir; (pnt=strstr(pnt,"/Maildir/"))!=NULL; pnt+=9 ){
         last = pnt;
@@ -881,7 +884,7 @@

     if(!last) return "";

-    for( pnt = last + 9; (*pnt && *pnt != '/' && j < 255); ++pnt, ++j ) {
+    for( pnt = last + length_domain_dir; (*pnt && *pnt != '/' && j < 255); ++pnt, ++j ) {
       email[j] = *pnt;
     }