Logger: Fix DB log messages not being populated
We need to `resize` the buffer string since `reserve` does not guarantee that the buffer is
actually available.
Follow-up on 298415fff3
This commit is contained in:
parent
eb387b5453
commit
e881e97c06
|
@ -528,9 +528,9 @@ void Logger::logPrint(bool hex, const char *filepath, int line, int level, const
|
|||
|
||||
if (level <= mDatabaseLevel) {
|
||||
if (zmDbConnected) {
|
||||
int syslogSize = syslogEnd-syslogStart;
|
||||
int syslogSize = syslogEnd - syslogStart;
|
||||
std::string escapedString;
|
||||
escapedString.reserve((syslogSize * 2) + 1);
|
||||
escapedString.resize((syslogSize * 2) + 1);
|
||||
mysql_real_escape_string(&dbconn, &escapedString[0], syslogStart, syslogSize);
|
||||
escapedString.resize(std::strlen(escapedString.c_str()));
|
||||
|
||||
|
|
Loading…
Reference in New Issue