mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-20 21:44:06 +01:00
Linux: Fix heap-buffer-overflow when passing command-line arguments to cef_unittests (issue #1458).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2272@2038 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
f51610dd36
commit
05daf76e95
@ -97,11 +97,13 @@ struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> { };
|
||||
class CefScopedArgArray {
|
||||
public:
|
||||
CefScopedArgArray(int argc, char* argv[]) {
|
||||
array_ = new char*[argc];
|
||||
// argv should have (argc + 1) elements, the last one always being NULL.
|
||||
array_ = new char*[argc + 1];
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
values_.push_back(argv[i]);
|
||||
array_[i] = const_cast<char*>(values_[i].c_str());
|
||||
}
|
||||
array_[argc] = NULL;
|
||||
}
|
||||
~CefScopedArgArray() {
|
||||
delete [] array_;
|
||||
|
Loading…
Reference in New Issue
Block a user