 +    *path_p = '/';
 +  }
 +  /* Replace any '//' with '/' */
-+  path_p = path;
++  path_p = path + !!*path; /* skip first character, if any, to handle UNC paths correctly */
 +  while ((path_p = strstr (path_p, "//")) != NULL)
 +  {
 +    memmove (path_p, path_p + 1, path_size--);

+  char * result = path;
+  char * result_p;
+  char const ** toks;
+  sanitise_path(result);
+  result_p = result;
+

 configure.ac         |   1 +
 lib/Makefile.inc     |   2 +
 lib/curl_config.h.in |   3 +
 lib/pathtools.c      | 562 +++++++++++++++++++++++++++++++++++++++++++
 lib/pathtools.h      |  57 +++++
 lib/url.c            |  26 +-
 6 files changed, 650 insertions(+), 1 deletion(-)
 create mode 100644 lib/pathtools.c
 create mode 100644 lib/pathtools.h

