Fossil

Check-in [f6ff25e1b7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Strengthen the file_is_canonical() routine so that it returns false on Windows if the pathname does not begin with a drive letter.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f6ff25e1b75579a88c7189fc0ea69eb0f5389d0717942e7c56183338d2b5b937
User & Date: drh 2024-11-21 13:34:40.346
Context
2024-11-22
15:11
When using --once with --ssh-command, prefer the command-line argument over the stored option. Addresses [forum:90c1f5fef258c704 | forum post 90c1f5fef258c704]. check-in: f019cb5fc3 user: andybradford tags: ssh-command-once
14:29
Provide the ability to make exceptions to maximum number of query parameters on the robot restrictor. check-in: 87368b3efd user: drh tags: trunk
2024-11-21
13:34
Strengthen the file_is_canonical() routine so that it returns false on Windows if the pathname does not begin with a drive letter. check-in: f6ff25e1b7 user: drh tags: trunk
13:06
Enhance the file_canonical_name() function so that it always includes the drive letter prefix on Windows. check-in: 40376ef892 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718


1719
1720
1721
1722
1723
1724
1725
** Return TRUE if the given filename is canonical.
**
** Canonical names are full pathnames using "/" not "\" and which
** contain no "/./" or "/../" terms.
*/
int file_is_canonical(const char *z){
  int i;
  if( z[0]!='/'
#if defined(_WIN32) || defined(__CYGWIN__)
    && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/')


#endif
  ) return 0;

  for(i=0; z[i]; i++){
    if( z[i]=='\\' ) return 0;
    if( z[i]=='/' ){
      if( z[i+1]=='.' ){







|

|
>
>







1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
** Return TRUE if the given filename is canonical.
**
** Canonical names are full pathnames using "/" not "\" and which
** contain no "/./" or "/../" terms.
*/
int file_is_canonical(const char *z){
  int i;
  if(
#if defined(_WIN32) || defined(__CYGWIN__)
    !fossil_isupper(z[0]) || z[1]!=':' || !fossil_isdirsep(z[2])
#else
    z[0]!='/'
#endif
  ) return 0;

  for(i=0; z[i]; i++){
    if( z[i]=='\\' ) return 0;
    if( z[i]=='/' ){
      if( z[i+1]=='.' ){