diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-23 06:43:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-23 06:43:22 -0700 |
commit | 56a3bfb691828a0cec5f3156c553efd8253fa914 (patch) | |
tree | 1e3660a0473bfdd6c42bf3a5d87d3e9ef2565a3a /parser.c | |
parent | 1067252f091ca438d19929523baaa0f8bf6a51cb (diff) | |
download | txr-56a3bfb691828a0cec5f3156c553efd8253fa914.tar.gz txr-56a3bfb691828a0cec5f3156c553efd8253fa914.tar.bz2 txr-56a3bfb691828a0cec5f3156c553efd8253fa914.zip |
Fix race in ~/.txr_profile security check.
* parser.c (load_rcfile): Apply the privacy test to
the open stream, rather than the file name, thus
guarding against the possibility that a verified
file object is replaced by another one before it
is opened.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -382,19 +382,19 @@ static void load_rcfile(val name) if (!funcall1(path_exists_p, name)) return; - if (!funcall1(path_private_to_me_p, name)) { - format(std_output, - lit("** possible security problem: ~a is writable to others\n"), - name, nao); - return; - } - uw_catch_begin (catch_syms, sy, va); open_txr_file(name, &lisp_p, &resolved_name, &stream); - if (stream) + if (stream) { + if (!funcall1(path_private_to_me_p, statf(stream))) { + format(std_output, + lit("** possible security problem: ~a is writable to others\n"), + name, nao); + } else { read_eval_stream(stream, std_output, nil); + } + } uw_catch(sy, va) { |