diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 872247701..266342ae4 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -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()));