X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=filebrowser%2Fpath.c;h=a3d6b46ebd3aea54727e9f84d0c50950586a9f4b;hb=0ea1b434ac6becf79c75d85ba27de5b89666a7c3;hp=4e13ea3c553097011e77c15d0e1eb7aa44597226;hpb=01768d1677ff891d503bbfa250b09d373bfa7422;p=xboard.git diff --git a/filebrowser/path.c b/filebrowser/path.c index 4e13ea3..a3d6b46 100644 --- a/filebrowser/path.c +++ b/filebrowser/path.c @@ -36,6 +36,11 @@ #include "xstat.h" #include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif /* ndef MAXPATHLEN */ + + #if defined(SVR4) || defined(SYSV) || defined(USG) extern uid_t getuid(); extern void qsort(); @@ -75,7 +80,7 @@ SFchdir(path) if (strcmp(path, SFcurrentDir)) { result = chdir(path); if (!result) { - (void) strcpy(SFcurrentDir, path); + (void) strncpy(SFcurrentDir, path, MAXPATHLEN); } } @@ -475,8 +480,9 @@ SFfindHomeDir(begin, end) if (!strcmp(SFhomeDir.entries[i].real, begin)) { *end = save; SFstrdup(&theRest, end); - (void) strcat(strcat(strcpy(SFcurrentPath, - SFlogins[i].dir), "/"), theRest); + (void) strcat(strcat(strncpy(SFcurrentPath,SFlogins[i].dir, + MAXPATHLEN), "/"), + theRest); XtFree(theRest); SFsetText(SFcurrentPath); SFtextChanged();