Index: src/ftpd.c
===================================================================
RCS file: /cvsroot/wu-ftpd-stable/src/ftpd.c,v
retrieving revision 1.21
diff -c -r1.21 ftpd.c
*** src/ftpd.c	1999/05/20 16:37:40	1.21
--- src/ftpd.c	1999/08/25 02:31:08
***************
*** 1211,1216 ****
--- 1211,1223 ----
        return path;
  }
  
+ char *mapping_getcwd(char *path, size_t size)
+ {
+     strncpy(path, mapped_path, size);
+     path[size-1] = '\0';
+     return path;
+ }
+ 
  /* Make these globals rather than local to mapping_chdir to avoid stack overflow */
  char pathspace[ MAXPATHLEN ];
  char old_mapped_path[ MAXPATHLEN ];
***************
*** 1244,1251 ****
  
        /* append the dir part with a leading / unless at root */
        if( !(mapped_path[0] == '/' && mapped_path[1] == '\0') )
                strcat( mapped_path, "/" );
!       strcat( mapped_path, dir );
  }
  
  int
--- 1251,1260 ----
  
        /* append the dir part with a leading / unless at root */
        if( !(mapped_path[0] == '/' && mapped_path[1] == '\0') )
+           if (strlen(mapped_path) < sizeof(mapped_path)-1)
                strcat( mapped_path, "/" );
!    if (sizeof(mapped_path)-strlen(mapped_path) > 1)
!       strncat( mapped_path, dir, sizeof(mapped_path)-strlen(mapped_path)-1 );
  }
  
  int
***************
*** 1293,1299 ****
  
  #define chdir(d) mapping_chdir(d)
  #define getwd(d) mapping_getwd(d)
! #define getcwd(d,u) mapping_getwd(d)
  
  #endif /* MAPPING_CHDIR */
  
--- 1302,1308 ----
  
  #define chdir(d) mapping_chdir(d)
  #define getwd(d) mapping_getwd(d)
! #define getcwd(d,u) mapping_getcwd((d),(u))
  
  #endif /* MAPPING_CHDIR */
  
