]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: remove old cruft from path_conv::check
authorKen Brown <kbrown@cornell.edu>
Sat, 21 Sep 2019 17:09:09 +0000 (13:09 -0400)
committerKen Brown <kbrown@cornell.edu>
Sat, 21 Sep 2019 17:09:09 +0000 (13:09 -0400)
commit9f24260ee90bec2506ae5c624dc06ab3fc67ae64
tree73f6c99e1e3cbc297fcffac830cf06c627a585d6
parent41864091014b63b0cb72ae98281fa53349b6ef77
Cygwin: remove old cruft from path_conv::check

Prior to commit b0717aae, path_conv::check had the following code:

      if (strncmp (path, "\\\\.\\", 4))
        {
          /* Windows ignores trailing dots and spaces in the last path
             component, and ignores exactly one trailing dot in inner
             path components. */
          char *tail = NULL;
          [...]
          if (!tail || tail == path)
            /* nothing */;
          else if (tail[-1] != '\\')
            {
              *tail = '\0';
          [...]
        }

Commit b0717aae0 intended to disable this code, but it inadvertently
disabled only part of it.  In particular, the declaration of the local
tail variable was in the disabled code, but the following remained:

          if (!tail || tail == path)
            /* nothing */;
          else if (tail[-1] != '\\')
            {
              *tail = '\0';
          [...]
        }

[A later commit removed the disabled code.]

The tail variable here points into a string different from path,
causing that string to be truncated under some circumstances.  See

  https://cygwin.com/ml/cygwin/2019-09/msg00001.html

for more details.

This commit fixes the problem by removing the leftover code
that was intended to be removed in b0717aae.
winsup/cygwin/path.cc
This page took 0.029743 seconds and 5 git commands to generate.