summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-08-15 20:47:23 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2019-08-16 09:30:54 +0200
commit289cd1f3d499f3f587bed2954dc5d878f75e0c68 (patch)
tree65eb3818fb99dd25913bc9a212ae3cac50863250
parentf5063b8733b0081e689894ba27a727549cb48321 (diff)
downloadefl-289cd1f3d499f3f587bed2954dc5d878f75e0c68.tar.gz
eolian-cxx: Fix use after free for base variable
T8137 Differential Revision: https://phab.enlightenment.org/D9575
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index 1e0842873d..6f719f178f 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -287,10 +287,10 @@ run(options_type const& opts)
{
const Eolian_Class *klass = nullptr;
char* dup = strdup(opts.in_files[0].c_str());
- char* base = basename(dup);
+ std::string base (basename(dup));
std::string cpp_types_header;
opts.unit = (Eolian_Unit*)opts.state;
- klass = ::eolian_state_class_by_file_get(opts.state, base);
+ klass = ::eolian_state_class_by_file_get(opts.state, base.c_str());
free(dup);
if (klass)
{
@@ -346,8 +346,8 @@ run(options_type const& opts)
opts.unit = unit;
}
char* dup = strdup(name.c_str());
- char* base = basename(dup);
- Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base);
+ std::string base(basename(dup));
+ Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base.c_str());
free(dup);
if (klass)
{