Fossil SCM
Strengthen the file_is_canonical() routine so that it returns false on Windows if the pathname does not begin with a drive letter.
Commit
f6ff25e1b75579a88c7189fc0ea69eb0f5389d0717942e7c56183338d2b5b937
Parent
40376ef892bbee0…
1 file changed
+4
-2
+4
-2
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -1711,13 +1711,15 @@ | ||
| 1711 | 1711 | ** Canonical names are full pathnames using "/" not "\" and which |
| 1712 | 1712 | ** contain no "/./" or "/../" terms. |
| 1713 | 1713 | */ |
| 1714 | 1714 | int file_is_canonical(const char *z){ |
| 1715 | 1715 | int i; |
| 1716 | - if( z[0]!='/' | |
| 1716 | + if( | |
| 1717 | 1717 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1718 | - && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/') | |
| 1718 | + !fossil_isupper(z[0]) || z[1]!=':' || !fossil_isdirsep(z[2]) | |
| 1719 | +#else | |
| 1720 | + z[0]!='/' | |
| 1719 | 1721 | #endif |
| 1720 | 1722 | ) return 0; |
| 1721 | 1723 | |
| 1722 | 1724 | for(i=0; z[i]; i++){ |
| 1723 | 1725 | if( z[i]=='\\' ) return 0; |
| 1724 | 1726 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1711,13 +1711,15 @@ | |
| 1711 | ** Canonical names are full pathnames using "/" not "\" and which |
| 1712 | ** contain no "/./" or "/../" terms. |
| 1713 | */ |
| 1714 | int file_is_canonical(const char *z){ |
| 1715 | int i; |
| 1716 | if( z[0]!='/' |
| 1717 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1718 | && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/') |
| 1719 | #endif |
| 1720 | ) return 0; |
| 1721 | |
| 1722 | for(i=0; z[i]; i++){ |
| 1723 | if( z[i]=='\\' ) return 0; |
| 1724 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -1711,13 +1711,15 @@ | |
| 1711 | ** Canonical names are full pathnames using "/" not "\" and which |
| 1712 | ** contain no "/./" or "/../" terms. |
| 1713 | */ |
| 1714 | int file_is_canonical(const char *z){ |
| 1715 | int i; |
| 1716 | if( |
| 1717 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1718 | !fossil_isupper(z[0]) || z[1]!=':' || !fossil_isdirsep(z[2]) |
| 1719 | #else |
| 1720 | z[0]!='/' |
| 1721 | #endif |
| 1722 | ) return 0; |
| 1723 | |
| 1724 | for(i=0; z[i]; i++){ |
| 1725 | if( z[i]=='\\' ) return 0; |
| 1726 |