@@ -138,8 +138,7 @@ void SaveMap::populateMapListbox( Bool systemMaps )
138138 CListBox *pList = (CListBox *)this ->GetDlgItem (IDC_SAVE_LIST);
139139 if (pList == NULL ) return ;
140140 pList->ResetContent ();
141- strcpy (findBuf, dirBuf);
142- strlcat (findBuf, " *.*" , ARRAY_SIZE (findBuf));
141+ snprintf (findBuf, ARRAY_SIZE (findBuf), " %s*.*" , dirBuf);
143142
144143 hFindFile = FindFirstFile (findBuf, &findData);
145144 if (hFindFile != INVALID_HANDLE_VALUE) {
@@ -149,11 +148,7 @@ void SaveMap::populateMapListbox( Bool systemMaps )
149148 if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ) {
150149 continue ;
151150 }
152- strcpy (fileBuf, dirBuf);
153- strlcat (fileBuf, findData.cFileName , ARRAY_SIZE (fileBuf));
154- strlcat (fileBuf, " \\ " , ARRAY_SIZE (fileBuf));
155- strlcat (fileBuf, findData.cFileName , ARRAY_SIZE (fileBuf));
156- strlcat (fileBuf, " .map" , ARRAY_SIZE (fileBuf));
151+ snprintf (fileBuf, ARRAY_SIZE (fileBuf), " %s%s\\ %s.map" , dirBuf, findData.cFileName , findData.cFileName );
157152 try {
158153 CFileStatus status;
159154 if (CFile::GetStatus (fileBuf, status)) {
@@ -169,7 +164,7 @@ void SaveMap::populateMapListbox( Bool systemMaps )
169164 }
170165 CEdit *pEdit = (CEdit*)GetDlgItem (IDC_SAVE_MAP_EDIT);
171166 if (pEdit != NULL ) {
172- strcpy (fileBuf, m_pInfo->filename );
167+ strlcpy (fileBuf, m_pInfo->filename , ARRAY_SIZE (fileBuf) );
173168 Int len = strlen (fileBuf);
174169 if (len>4 && stricmp (" .map" , fileBuf+(len-4 )) == 0 ) {
175170 // strip of the .map
0 commit comments