@@ -458,9 +458,9 @@ CF_PRIVATE CFMutableArrayRef _CFCreateContentsOfDirectory(CFAllocatorRef alloc,
458458 // Ugh; must stat.
459459 char subdirPath [CFMaxPathLength ];
460460 struct statinfo statBuf ;
461- strlcpy (subdirPath , dirPath , sizeof (subdirPath ));
462- strlcat (subdirPath , "/" , sizeof (subdirPath ));
463- strlcat (subdirPath , dp -> d_name , sizeof (subdirPath ));
461+ cf_strlcpy (subdirPath , dirPath , sizeof (subdirPath ));
462+ cf_strlcat (subdirPath , "/" , sizeof (subdirPath ));
463+ cf_strlcat (subdirPath , dp -> d_name , sizeof (subdirPath ));
464464 if (stat (subdirPath , & statBuf ) == 0 ) {
465465 isDir = ((statBuf .st_mode & S_IFMT ) == S_IFDIR );
466466 }
@@ -1040,7 +1040,7 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
10401040 // Make sure there is room for the additional space we need in the win32 api
10411041 if (strlen (directoryPathBuf ) > CFMaxPathSize - 2 ) return ;
10421042
1043- strlcat (directoryPathBuf , "\\*" , CFMaxPathSize );
1043+ cf_strlcat (directoryPathBuf , "\\*" , CFMaxPathSize );
10441044
10451045 UniChar wideBuf [CFMaxPathSize ];
10461046
@@ -1110,8 +1110,8 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
11101110 struct stat statBuf ;
11111111 char pathToStat [sizeof (dent -> d_name )];
11121112 strncpy (pathToStat , directoryPathBuf , sizeof (pathToStat ));
1113- strlcat (pathToStat , "/" , sizeof (pathToStat ));
1114- strlcat (pathToStat , dent -> d_name , sizeof (pathToStat ));
1113+ cf_strlcat (pathToStat , "/" , sizeof (pathToStat ));
1114+ cf_strlcat (pathToStat , dent -> d_name , sizeof (pathToStat ));
11151115 if (stat (pathToStat , & statBuf ) == 0 ) {
11161116 if (S_ISDIR (statBuf .st_mode )) {
11171117 dent -> d_type = DT_DIR ;
@@ -1135,7 +1135,7 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
11351135 CFStringRef fileName = CFStringCreateWithFileSystemRepresentation (kCFAllocatorSystemDefault , dent -> d_name );
11361136
11371137 // This buffer has to be 1 bigger than the size of the one in the dirent so we can hold the extra '/' if it's required
1138- // Be sure to initialize the first character to null, so that strlcat below works correctly
1138+ // Be sure to initialize the first character to null, so that cf_strlcat below works correctly
11391139 #if TARGET_OS_WASI
11401140 // wasi-libc's dirent.d_name is not a fixed-size array but a pointer, so we need to calculate
11411141 // the size of buffer at first.
@@ -1199,8 +1199,8 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
11991199 struct stat statBuf ;
12001200 char pathToStat [sizeof (dent -> d_name )];
12011201 strncpy (pathToStat , directoryPathBuf , sizeof (pathToStat ));
1202- strlcat (pathToStat , "/" , sizeof (pathToStat ));
1203- strlcat (pathToStat , dent -> d_name , sizeof (pathToStat ));
1202+ cf_strlcat (pathToStat , "/" , sizeof (pathToStat ));
1203+ cf_strlcat (pathToStat , dent -> d_name , sizeof (pathToStat ));
12041204 if (stat (pathToStat , & statBuf ) == 0 ) {
12051205 isDirectory = S_ISDIR (statBuf .st_mode );
12061206 }
@@ -1210,11 +1210,11 @@ CF_PRIVATE void _CFIterateDirectory(CFStringRef directoryPath, Boolean appendSla
12101210
12111211 if (isDirectory ) {
12121212 // Append the file name and the trailing /
1213- strlcat (fullPathToFile , dent -> d_name , sizeof (fullPathToFile ));
1214- strlcat (fullPathToFile , "/" , sizeof (fullPathToFile ));
1213+ cf_strlcat (fullPathToFile , dent -> d_name , sizeof (fullPathToFile ));
1214+ cf_strlcat (fullPathToFile , "/" , sizeof (fullPathToFile ));
12151215 } else if (stuffToPrefix ) {
12161216 // Append just the file name to our previously-used buffer
1217- strlcat (fullPathToFile , dent -> d_name , sizeof (fullPathToFile ));
1217+ cf_strlcat (fullPathToFile , dent -> d_name , sizeof (fullPathToFile ));
12181218 }
12191219
12201220
0 commit comments