@@ -1635,10 +1635,8 @@ GIT_INLINE(bool) only_spaces_and_dots(const char *path)
16351635 return true;
16361636}
16371637
1638- GIT_INLINE (bool ) verify_dotgit_ntfs_generic (const char * name , const char * dotgit_name , const char * shortname_pfix )
1638+ GIT_INLINE (bool ) verify_dotgit_ntfs_generic (const char * name , size_t len , const char * dotgit_name , size_t dotgit_len , const char * shortname_pfix )
16391639{
1640- size_t len = strlen (name );
1641- size_t dotgit_len = strlen (dotgit_name );
16421640 int i , saw_tilde ;
16431641
16441642 if (name [0 ] == '.' && len >= dotgit_len &&
@@ -1842,64 +1840,64 @@ int git_path_normalize_slashes(git_buf *out, const char *path)
18421840 return 0 ;
18431841}
18441842
1845- static int verify_dotgit_generic (const char * name , const char * dotgit_name , const char * shortname_pfix )
1843+ static int verify_dotgit_generic (const char * name , size_t len , const char * dotgit_name , size_t dotgit_len , const char * shortname_pfix )
18461844{
1847- if (!verify_dotgit_ntfs_generic (name , dotgit_name , shortname_pfix ))
1845+ if (!verify_dotgit_ntfs_generic (name , len , dotgit_name , dotgit_len , shortname_pfix ))
18481846 return false;
18491847
1850- return verify_dotgit_hfs_generic (name , strlen ( name ) , dotgit_name , strlen ( dotgit_name ) );
1848+ return verify_dotgit_hfs_generic (name , len , dotgit_name , dotgit_len );
18511849}
18521850
1853- int git_path_is_ntfs_dotgit_modules (const char * name )
1851+ int git_path_is_ntfs_dotgit_modules (const char * name , size_t len )
18541852{
1855- return !verify_dotgit_ntfs_generic (name , "gitmodules" , "gi7eba" );
1853+ return !verify_dotgit_ntfs_generic (name , len , "gitmodules" , CONST_STRLEN ( "gitmodules" ) , "gi7eba" );
18561854}
18571855
1858- int git_path_is_hfs_dotgit_modules (const char * name )
1856+ int git_path_is_hfs_dotgit_modules (const char * name , size_t len )
18591857{
1860- return !verify_dotgit_hfs_generic (name , strlen ( name ) , "gitmodules" , CONST_STRLEN ("gitmodules" ));
1858+ return !verify_dotgit_hfs_generic (name , len , "gitmodules" , CONST_STRLEN ("gitmodules" ));
18611859}
18621860
1863- int git_path_is_dotgit_modules (const char * name )
1861+ int git_path_is_dotgit_modules (const char * name , size_t len )
18641862{
1865- if (git_path_is_hfs_dotgit_modules (name ))
1863+ if (git_path_is_hfs_dotgit_modules (name , len ))
18661864 return 1 ;
18671865
1868- return git_path_is_ntfs_dotgit_modules (name );
1866+ return git_path_is_ntfs_dotgit_modules (name , len );
18691867}
18701868
1871- int git_path_is_ntfs_dotgit_ignore (const char * name )
1869+ int git_path_is_ntfs_dotgit_ignore (const char * name , size_t len )
18721870{
1873- return !verify_dotgit_ntfs_generic (name , "gitignore" , "gi250a" );
1871+ return !verify_dotgit_ntfs_generic (name , len , "gitignore" , CONST_STRLEN ( "gitignore" ) , "gi250a" );
18741872}
18751873
1876- int git_path_is_hfs_dotgit_ignore (const char * name )
1874+ int git_path_is_hfs_dotgit_ignore (const char * name , size_t len )
18771875{
1878- return !verify_dotgit_hfs_generic (name , strlen ( name ) , "gitignore" , CONST_STRLEN ("gitignore" ));
1876+ return !verify_dotgit_hfs_generic (name , len , "gitignore" , CONST_STRLEN ("gitignore" ));
18791877}
18801878
1881- int git_path_is_dotgit_ignore (const char * name )
1879+ int git_path_is_dotgit_ignore (const char * name , size_t len )
18821880{
1883- if (git_path_is_hfs_dotgit_ignore (name ))
1881+ if (git_path_is_hfs_dotgit_ignore (name , len ))
18841882 return 1 ;
18851883
1886- return git_path_is_ntfs_dotgit_ignore (name );
1884+ return git_path_is_ntfs_dotgit_ignore (name , len );
18871885}
18881886
1889- int git_path_is_hfs_dotgit_attributes (const char * name )
1887+ int git_path_is_hfs_dotgit_attributes (const char * name , size_t len )
18901888{
1891- return !verify_dotgit_hfs_generic (name , strlen ( name ) , "gitattributes" , CONST_STRLEN ("gitattributes" ));
1889+ return !verify_dotgit_hfs_generic (name , len , "gitattributes" , CONST_STRLEN ("gitattributes" ));
18921890}
18931891
1894- int git_path_is_ntfs_dotgit_attributes (const char * name )
1892+ int git_path_is_ntfs_dotgit_attributes (const char * name , size_t len )
18951893{
1896- return !verify_dotgit_ntfs_generic (name , "gitattributes" , "gi7d29" );
1894+ return !verify_dotgit_ntfs_generic (name , len , "gitattributes" , CONST_STRLEN ( "gitattributes" ) , "gi7d29" );
18971895}
18981896
1899- int git_path_is_dotgit_attributes (const char * name )
1897+ int git_path_is_dotgit_attributes (const char * name , size_t len )
19001898{
1901- if (git_path_is_hfs_dotgit_attributes (name ))
1899+ if (git_path_is_hfs_dotgit_attributes (name , len ))
19021900 return 1 ;
19031901
1904- return git_path_is_ntfs_dotgit_attributes (name );
1902+ return git_path_is_ntfs_dotgit_attributes (name , len );
19051903}
0 commit comments