AP_Common: fix initialization of ExpandingString so that it can be used on the stack

zero out passed in buffers for ExpandingString
This commit is contained in:
Andy Piper 2024-01-27 16:36:35 +00:00 committed by Peter Barker
parent 8c2f686bfa
commit 0c6ea4790d
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,13 @@ extern const AP_HAL::HAL& hal;
#define EXPAND_INCREMENT 512 #define EXPAND_INCREMENT 512
ExpandingString::ExpandingString(char* s, uint32_t total_len) : buf(0)
{
set_buffer(s, total_len, 0);
memset(buf, 0, buflen);
}
/* /*
expand the string buffer expand the string buffer
*/ */

View File

@ -24,6 +24,8 @@
class ExpandingString { class ExpandingString {
public: public:
ExpandingString() : buf(0), buflen(0), used(0), allocation_failed(false), external_buffer(false) {}
ExpandingString(char* s, uint32_t total_len);
const char *get_string(void) const { const char *get_string(void) const {
return buf; return buf;