Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix secondary weapon models registering
Several people have noticed a curious regression which cause some secondary weapon models (such as machinegun's barrel) to not be rendered. For instance: - OpenArena#316 - OpenArena/engine#85 - https://forum.manjaro.org/t/openarena-lightning-gun-beam-not-visible-with-glibc-2-37-x86-64-bug/135312 And some people have hypothesized that this could have something to do with a recent change in glibc. I'm also facing this issue since an upgrade from ubuntu 22.04 to 24.04 and I've found its cause, here is the patch. As you can see the logic to add a suffix to the primary weapon model was previously based on a call to COM_StripExtension() with the same pointer for in & out. However, this function passes in & out to Q_strncpyz() which itself relies on strncpy() which does not specify the expected behavior in case of aliasing/overlapping of src & dst. So it was relying on an unspecified behavior, prone to change at any time and without any communication. This patch passes the build step but I've tested it in-game with the legacy project https://github.com/OpenArena/legacy and a back-ported version of it.
- Loading branch information