]> git.eshelyaron.com Git - emacs.git/commit
Reject filenames containing NUL bytes.
authorPhilipp Stephani <phst@google.com>
Wed, 23 Dec 2020 11:00:46 +0000 (12:00 +0100)
committerPhilipp Stephani <phst@google.com>
Wed, 23 Dec 2020 11:00:46 +0000 (12:00 +0100)
commit3cbd4169d6dd370b4fa8180fc2adfbf426f57837
tree11b24ad133c4f24f9e8d8798f4fb482944de15ab
parent3edc4fd53ff9e1355da2371400aac4d5897ca190
Reject filenames containing NUL bytes.

Such filenames are dangerous, as Emacs would silently only use the
part up to the first NUL byte.  Reject them explicitly instead.

* src/coding.c (encode_file_name_1): New helper function.
(encode_file_name): Check that encoded filename doesn't contain a
NUL byte.
(syms_of_coding): Define 'filenamep' symbol.

* test/src/fileio-tests.el (fileio-tests/null-character): New unit
test.

* etc/NEWS: Document change.
etc/NEWS
src/coding.c
test/src/fileio-tests.el