Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Overlapping src and dest for strcpy in Client Code #639

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bilgincoskun
Copy link

Recently, when playing with OpenArena assets, I noticed some visual glitches (lightning gun beam and a part of a machine gun are missing). Luckily, another user pinpointed the exact issue, which is a glibc commit:

https://forum.manjaro.org/t/openarena-lightning-gun-beam-not-visible-with-glibc-2-37-x86-64-bug/135312/8

https://sourceware.org/git?p=glibc.git;a=commit;h=642933158e7cf072d873231b1a9bb03291f2b989

An issue on another project concerning the glibc commit (https://sourceware.org/bugzilla/show_bug.cgi?id=30112) shows that this is due to invalidating str*cpy invariant that src and destination cannot overlap.

Indeed, upon inspection with AddressSanitizer, you can see src and dest arguments of strncpy overlap in cl_cgame.c and cl_ui.c

This PR adds a safe reimplementation of Strncpy, that is safe against overlapping src and dest and fixes the visual glitches on OpenArena.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant