Merge pull request #9131 from ChillerDragon/pr_fix_mysql_null_bind

Fix empty vector element access in mysql prepare
This commit is contained in:
Dennis Felsing 2024-10-09 07:33:42 +00:00 committed by GitHub
commit a9e52d2b7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -331,8 +331,11 @@ bool CMysqlConnection::PrepareStatement(const char *pStmt, char *pError, int Err
unsigned NumParameters = mysql_stmt_param_count(m_pStmt.get());
m_vStmtParameters.resize(NumParameters);
m_vStmtParameterExtras.resize(NumParameters);
mem_zero(&m_vStmtParameters[0], sizeof(m_vStmtParameters[0]) * m_vStmtParameters.size());
mem_zero(&m_vStmtParameterExtras[0], sizeof(m_vStmtParameterExtras[0]) * m_vStmtParameterExtras.size());
if(NumParameters)
{
mem_zero(&m_vStmtParameters[0], sizeof(m_vStmtParameters[0]) * m_vStmtParameters.size());
mem_zero(&m_vStmtParameterExtras[0], sizeof(m_vStmtParameterExtras[0]) * m_vStmtParameterExtras.size());
}
return false;
}