This crashes my code due to buffer read overflow.
My fix is as follows. Is it correct?
--- a/backward.hpp
+++ b/backward.hpp
@@ -1,4 +1,4 @@
-/*
+/*
* backward.hpp
* Copyright 2013 Google Inc. All Rights Reserved.
*
@@ -3627,9 +3627,7 @@ public:
ret.image_name = temp;
GetModuleBaseNameA(process, module, temp, sizeof(temp));
ret.module_name = temp;
- std::vector<char> img(ret.image_name.begin(), ret.image_name.end());
- std::vector<char> mod(ret.module_name.begin(), ret.module_name.end());
- SymLoadModule64(process, 0, &img[0], &mod[0], (DWORD64)ret.base_address,
+ SymLoadModule64(process, 0, ret.image_name.c_str(), ret.module_name.c_str(), (DWORD64)ret.base_address,
ret.load_size);
return ret;
}
What is the point of (seeming deliberately) converting 2
std::stringvariables to typestd::vector<char>, which strips their ending'\0', before passing them to an API which REQUIRES strings are ended with'\0'?This crashes my code due to buffer read overflow.
My fix is as follows. Is it correct?