Fix ]\n being included in the db Logs entry. Also removes a strlen so performance should improve

This commit is contained in:
Isaac Connor 2021-02-24 12:37:09 -05:00
parent 58e3d96f8c
commit 9959464ef7
1 changed files with 3 additions and 2 deletions

View File

@ -536,8 +536,9 @@ void Logger::logPrint(bool hex, const char * const filepath, const int line, con
if ( level <= mDatabaseLevel ) {
if (db_mutex.try_lock_for(1)) {
char escapedString[(strlen(syslogStart)*2)+1];
mysql_real_escape_string(&dbconn, escapedString, syslogStart, strlen(syslogStart));
int syslogSize = syslogEnd-syslogStart;
char escapedString[(syslogSize*2)+1];
mysql_real_escape_string(&dbconn, escapedString, syslogStart, syslogSize);
char sql[ZM_SQL_MED_BUFSIZ];
snprintf(sql, sizeof(sql),