diff options
author | Sho Amano <samano@xevo.com> | 2017-06-19 22:05:04 +0900 |
---|---|---|
committer | Sho Amano <samano@xevo.com> | 2017-07-19 14:02:42 +0900 |
commit | 1b7b9eef9897c3126b94163fd820ad691cb59825 (patch) | |
tree | 0d065de674de650cea1621a05feba32c6b673ee3 /src | |
parent | 3dc63916e89d15e84a6e7e636e764c8f794f3775 (diff) | |
download | sdl_core-1b7b9eef9897c3126b94163fd820ad691cb59825.tar.gz |
fix: memory issue in FromMicToFileRecorderThread
Strings were not copied properly, instead pointers to buffers
were copied. One of the buffer was released immediately,
causing memory access through a dangling pointer.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index 0239795d75..a514959701 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -32,6 +32,7 @@ #include "media_manager/audio/from_mic_to_file_recorder_thread.h" #include <unistd.h> +#include <cstring> #include <sstream> #include "utils/logger.h" @@ -88,11 +89,11 @@ void FromMicToFileRecorderThread::initArgs() { argv_[3] = new gchar[3]; argv_[4] = new gchar[durationString_.length() + 1]; - argv_[0] = const_cast<gchar*>(std::string("AudioManager").c_str()); - argv_[1] = const_cast<gchar*>(oKey_.c_str()); - argv_[2] = const_cast<gchar*>(outputFileName_.c_str()); - argv_[3] = const_cast<gchar*>(tKey_.c_str()); - argv_[4] = const_cast<gchar*>(durationString_.c_str()); + std::strcpy(argv_[0], "AudioManager"); + std::strcpy(argv_[1], oKey_.c_str()); + std::strcpy(argv_[2], outputFileName_.c_str()); + std::strcpy(argv_[3], tKey_.c_str()); + std::strcpy(argv_[4], durationString_.c_str()); } void FromMicToFileRecorderThread::threadMain() { |