2004-12-18 Ralf Wildenhues * libltdl/ltdl.c [cygwin, mingw] (opendir): Fix write of constant strings past end of buffer. (opendir, readdir): Fix read past end of buffer. Index: libltdl/ltdl.c =================================================================== RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v retrieving revision 1.174.2.9 diff -u -r1.174.2.9 ltdl.c --- libltdl/ltdl.c 16 Dec 2004 11:58:45 -0000 1.174.2.9 +++ libltdl/ltdl.c 18 Dec 2004 20:44:32 -0000 @@ -457,7 +457,9 @@ DIR *entry; assert(path != (char *) NULL); - (void) strncpy(file_specification,path,LT_FILENAME_MAX-1); + /* allow space for: path + '\\' '\\' '*' '.' '*' + '\0' */ + (void) strncpy (file_specification, path, LT_FILENAME_MAX-6); + file_specification[LT_FILENAME_MAX-6] = LT_EOS_CHAR; (void) strcat(file_specification,"\\"); entry = LT_DLMALLOC (DIR,sizeof(DIR)); if (entry != (DIR *) 0) @@ -498,6 +500,7 @@ entry->firsttime = FALSE; (void) strncpy(entry->file_info.d_name,entry->Win32FindData.cFileName, LT_FILENAME_MAX-1); + entry->file_info.d_name[LT_FILENAME_MAX - 1] = LT_EOS_CHAR; entry->file_info.d_namlen = strlen(entry->file_info.d_name); return(&entry->file_info); }