mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-25 23:10:47 -08:00
Check for null bytes in filenames in 'expand-file-name' (bug#49723)
* src/fileio.c (expand-file-name): Check for null bytes for both NAME and DEFAULT-DIRECTORY arguments. Also check for null bytes in buffer-local default-directory, assuming it is used. * src/coding.c (encode_file_name): Use CHECK_STRING_NULL_BYTES. * src/lisp.h (CHECK_STRING_NULL_BYTES): Add function for checking for null bytes in Lisp strings. * test/src/fileio-tests.el (fileio-test--expand-file-name-null-bytes): Add test for new changes to expand-file-name. * etc/NEWS: Announce changes.
This commit is contained in:
parent
62e870691d
commit
4e21c5f451
5 changed files with 29 additions and 3 deletions
|
|
@ -10430,8 +10430,7 @@ encode_file_name (Lisp_Object fname)
|
|||
cause subtle bugs because the system would silently use a
|
||||
different filename than expected. Perform this check after
|
||||
encoding to not miss NUL bytes introduced through encoding. */
|
||||
CHECK_TYPE (memchr (SSDATA (encoded), '\0', SBYTES (encoded)) == NULL,
|
||||
Qfilenamep, fname);
|
||||
CHECK_STRING_NULL_BYTES (encoded);
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue