#include <assert.h>
#include <errno.h>
+/** Change by florez-l@javeriana.edu.co **/
+#if defined(WIN32)
+# define NEW_STRCPY(A,B) strcpy_s(A,strlen(A),B)
+# define NEW_STRNCPY(A,B,C) strncpy_s(A,C,B,C)
+#else // defined(WIN32)
+# define NEW_STRCPY(A,B) strcpy(A,B)
+# define NEW_STRNCPY(A,B,C) strncpy(A,B,C)
+#endif // defined(WIN32)
+
/* use ffblk instead of _find_t if requested */
#if defined(DIRENT_USE_FFBLK)
# define _A_ARCH (FA_ARCH)
* Directory separator is not appended if the name already ends with
* drive or directory separator. Directory separator is assumed to be
* '/' or '\' and drive separator is assumed to be ':'. */
- strcpy (dirp->dirname, dirname);
+ NEW_STRCPY (dirp->dirname, dirname);
p = strchr (dirp->dirname, '\0');
if (dirp->dirname < p &&
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
{
- strcpy (p++, "/");
+ NEW_STRCPY (p++, "/");
}
# ifdef DIRENT_WIN32_INTERFACE
- strcpy (p, "*"); /*scan files with and without extension in win32*/
+ NEW_STRCPY (p, "*"); /*scan files with and without extension in win32*/
# else
- strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
+ NEW_STRCPY (p, "*.*"); /*scan files with and without extension in DOS*/
# endif
/* open stream */
/* make sure that d_name is long enough */
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
- strncpy (dirp->current.d_name,
+ NEW_STRNCPY (dirp->current.d_name,
_getdirname (&dirp->current),
NAME_MAX);
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/