diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-07-08 15:09:16 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-07-08 15:13:21 +0200 |
commit | 6791165b2a0e707f719efec08aad62cdf6ed8ad3 (patch) | |
tree | d98f464114aa6b60c7fa8156e26e3edb9a019585 /src/fileio.c | |
parent | 739e3dbe050468e1d9aa0a48bfc656ae20fd8f9d (diff) | |
download | emacs-6791165b2a0e707f719efec08aad62cdf6ed8ad3.tar.gz |
Fix file-name-case-insensitive-p in ffap (bug#56443)
Don't crash if the file name argument to file-name-case-insensitive-p,
after expansion, doesn't have a parent directory. This occurs
when calling ffap on something that looks like an email address.
* src/fileio.c (Ffile_name_case_insensitive_p): Return nil if no file
or parent directory could be found.
* test/src/fileio-tests.el (fileio-tests--identity-expand-handler)
(fileio--file-name-case-insensitive-p): New test.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index d07e62a1212..9697f6c8cf1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2601,9 +2601,9 @@ is case-insensitive. */) if (err <= 0) return err < 0 ? Qt : Qnil; Lisp_Object parent = file_name_directory (filename); - /* Avoid infinite loop if the root has trouble - (impossible?). */ - if (!NILP (Fstring_equal (parent, filename))) + /* Avoid infinite loop if the root has trouble (if that's even possible). + Without a parent, we just don't know and return nil as well. */ + if (!STRINGP (parent) || !NILP (Fstring_equal (parent, filename))) return Qnil; filename = parent; } |