Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
11.8.9, 12.0.2, 12.1.2, 12.2.2, 12.3.3, 13.1.1
-
OpenBSD
Description
Some MariaDB binaries (e.g. mariadb-backup) might need to fetch the program name for the running process. E.g. they might need to respawn themselves so they'd need that.
But reading argv[0] is not a very reliable way to do this: some OSes might spoof it.
So the code takes extra measures to acquire the actual executable name from the OS, where available.
On OpenBSD there is a getexecpath() API that provides this. But it was not called by my_get_exepath(). As a result, on that OS, it was falling back to argv[0] which is not a very reliable source as already established.
Fixed my_get_exepath() to use getexecpath() if available. Added a test to cover this.