diff options
author | Jason Molenda <jmolenda@apple.com> | 2014-10-16 23:10:03 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2014-10-16 23:10:03 +0000 |
commit | bc464ee614b8687fc1608410eb287dc19d13693e (patch) | |
tree | 71ca143df0c8b493415f178501ac63d030f19cf6 /lldb/source/Expression/ClangExpressionParser.cpp | |
parent | 511247188fbc1b0d5aec998e30628eb17d527775 (diff) | |
download | bcm5719-llvm-bc464ee614b8687fc1608410eb287dc19d13693e.tar.gz bcm5719-llvm-bc464ee614b8687fc1608410eb287dc19d13693e.zip |
Change a use of mktemp() to mkstemp() for better security.
We have two more uses of mktemp still in the source base
but they'll take a little more consideration.
clang static analyzer fixit.
llvm-svn: 219983
Diffstat (limited to 'lldb/source/Expression/ClangExpressionParser.cpp')
-rw-r--r-- | lldb/source/Expression/ClangExpressionParser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index 98446bb6ad8..ad7ec2f9da3 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -312,11 +312,11 @@ ClangExpressionParser::Parse (Stream &stream) temp_source_path = "/tmp/expr.XXXXXX"; } - if (mktemp(&temp_source_path[0])) + int temp_fd = ::mkstemp(&temp_source_path[0]); + + if (temp_fd != -1) { - lldb_private::File file (temp_source_path.c_str(), - File::eOpenOptionWrite | File::eOpenOptionCanCreateNewOnly, - lldb::eFilePermissionsFileDefault); + lldb_private::File file (temp_fd, true); const size_t expr_text_len = strlen(expr_text); size_t bytes_written = expr_text_len; if (file.Write(expr_text, bytes_written).Success()) |