+ 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 );
}