X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Feditfns.c;h=8ad18f53e0210628136c3f3fb8357a2538a4776b;hb=3f711eea68ce5fd586297b43c8d9936cd2ba916f;hp=ca314b972d617f381e9b0a6ed5a472f3d3c3ca91;hpb=dbf2768f7b146e97e37a27316f70bb313f1acf15;p=chise%2Fxemacs-chise.git.1 diff --git a/src/editfns.c b/src/editfns.c index ca314b9..8ad18f5 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -644,14 +644,17 @@ On Unix it is obtained from TMPDIR, with /tmp as the default. } else { - strcpy(path, getenv("HOME")); strncat(path, "/tmp/", _POSIX_PATH_MAX); + path[5 + _POSIX_PATH_MAX] = '\0'; + strncpy(path, getenv("HOME"), 5 + _POSIX_PATH_MAX); + strncat(path, "/tmp/", 5 + _POSIX_PATH_MAX); if (stat(path, &st) < 0 && errno == ENOENT) { int fd; - char warnpath[1+_POSIX_PATH_MAX]; + char warnpath[6+_POSIX_PATH_MAX]; mkdir(path, 0700); /* ignore retvals */ - strcpy(warnpath, path); - strncat(warnpath, ".created_by_xemacs", _POSIX_PATH_MAX); + warnpath[_POSIX_PATH_MAX] = '\0'; + strncpy(warnpath, path, 5 + _POSIX_PATH_MAX); + strncat(warnpath, ".created_by_xemacs", 5 + _POSIX_PATH_MAX); if ((fd = open(warnpath, O_WRONLY|O_CREAT, 0644)) > 0) { write(fd, "XEmacs created this directory because /tmp/ was unavailable -- \nPlease check !\n", 89);