Repository navigation
Fix crash in dbi_connect: initialize DatabaseInfo::charset - #1170
Merged
Merged
Conversation
Member
|
Thanks! |
Geesu
added a commit
to wc3mods/war3ft
that referenced
this pull request
Nov 11, 2026
…fresh clone 5488 fixes the mysql module's dbi_connect crash (alliedmodders/amxmodx#1170). The build script also creates build/ and build_tmp/ itself, so it works on a fresh clone.
Geesu
added a commit
to wc3mods/war3x
that referenced
this pull request
Nov 11, 2026
…fresh clone 5488 fixes the mysql module's dbi_connect crash (alliedmodders/amxmodx#1170). The build script also creates build/ and build_tmp/ itself, so it works on a fresh clone.
Geesu
added a commit
to wc3mods/war3xp
that referenced
this pull request
Nov 11, 2026
…fresh clone 5488 fixes the mysql module's dbi_connect crash (alliedmodders/amxmodx#1170). The build script also creates build/ and build_tmp/ itself, so it works on a fresh clone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Plugins using the legacy DBI natives crash the server as soon as
dbi_connect()successfully logs in to MySQL.dbi_connect()inmodules/mysqlx/oldcompat_sql.cppbuilds aDatabaseInfoon the stack and sets host, user, pass, database and port, but nevercharset. TheDatabaseInfoconstructor only initializesmax_timeout, socharsetholds stack garbage. After a successful login,MysqlDriver::_Connect()does:which dereferences that garbage pointer:
A failed login (e.g. a wrong password) returns before this point, so the crash only shows up once the credentials are correct. SQLX callers (
SQL_MakeDbTuple/SQL_Connect, threaded queries) setcharsetexplicitly and aren't affected.Fix
Initialize
charsettonullptrin theDatabaseInfoconstructor, which covers every caller. The sqlite copy ofISQLDriver.hhas the same struct, so it gets the same change to keep the two in sync.Testing
Linux: HLDS build 10211, Metamod 1.21.1-am, AMX Mod X 1.10.0.5467 (module rebuilt from that revision with this change), MariaDB 10.6.