* src/w32.c (parse_root): Avoid crashes due to invalid (too short)
UNC names, such as "\\". (Bug#70914)
* test/src/fileio-tests.el (fileio-tests-invalid-UNC): New test.
(cherry picked from commit
350ae75f5c1c47a03560e43e8699781c04c9078a)
name += 2;
do
{
- if (IS_DIRECTORY_SEP (*name) && --slashes == 0)
+ if (!*name || (IS_DIRECTORY_SEP (*name) && --slashes == 0))
break;
name++;
}
(should (equal (expand-file-name file nil) file))
(file-name-case-insensitive-p file)))
+(ert-deftest fileio-tests-invalid-UNC ()
+ (skip-unless (eq system-type 'windows-nt))
+ ;; These should not crash, see bug#70914.
+ (should-not (file-exists-p "//"))
+ (should (file-attributes "//")))
+
;;; fileio-tests.el ends here