diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-04-06 15:20:08 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-04-09 11:34:48 +0200 |
commit | 402cbc5be26827244075dbe14288e7722290f83a (patch) | |
tree | 6238d25cbd648e14cb1dcc309a8542fc312e40bf /src/w32fns.c | |
parent | 20eb4247cdc2eeada43c3de8abf9c577be38c98f (diff) | |
download | emacs-402cbc5be26827244075dbe14288e7722290f83a.tar.gz |
Don't rely on copying in {EN,DE}CODE_FILE
Callers of ENCODE_FILE and DECODE_FILE should not assume that these
functions always return a new string (bug#40407).
* src/w32fns.c (Fw32_shell_execute):
* src/w32proc.c (Fw32_application_type):
Sink taking the address of a Lisp string past GC points.
Copy values returned from ENCODE_FILE before mutating them.
Diffstat (limited to 'src/w32fns.c')
-rw-r--r-- | src/w32fns.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 9bb4e27b018..8d714f0b8d0 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -8258,7 +8258,6 @@ a ShowWindow flag: /* Encode filename, current directory and parameters. */ current_dir = GUI_ENCODE_FILE (current_dir); document = GUI_ENCODE_FILE (document); - doc_w = GUI_SDATA (document); if (STRINGP (parameters)) { parameters = GUI_ENCODE_SYSTEM (parameters); @@ -8269,6 +8268,7 @@ a ShowWindow flag: operation = GUI_ENCODE_SYSTEM (operation); ops_w = GUI_SDATA (operation); } + doc_w = GUI_SDATA (document); result = (intptr_t) ShellExecuteW (NULL, ops_w, doc_w, params_w, GUI_SDATA (current_dir), (FIXNUMP (show_flag) @@ -8353,7 +8353,7 @@ a ShowWindow flag: handler = Ffind_file_name_handler (absdoc, Qfile_exists_p); if (NILP (handler)) { - Lisp_Object absdoc_encoded = ENCODE_FILE (absdoc); + Lisp_Object absdoc_encoded = Fcopy_sequence (ENCODE_FILE (absdoc)); if (faccessat (AT_FDCWD, SSDATA (absdoc_encoded), F_OK, AT_EACCESS) == 0) { |