Skip to content

Stop MAPSTRINGS from reading past the property lists - #368

Merged
DCurrent merged 1 commit into
DCurrent:masterfrom
MRinkl:fix-mapstrings-list-overrun
Sep 22, 2026
Merged

DCurrent merged 1 commit into
DCurrent:masterfrom
MRinkl:fix-mapstrings-list-overrun

Conversation

@MRinkl

@MRinkl MRinkl commented Sep 22, 2026

Copy link
Copy Markdown

Pull Request

General Description

Fixes a crash in the script error path. When a script names a property that a MAPSTRINGS list does not contain, the macro prints the list of valid names with

for(proplist_cursor = 0; LIST[proplist_cursor] != NULL; proplist_cursor++)

None of the 32 property lists in openborscript.c and source/openborscript/*.c end with a NULL entry, so the loop walks past the array and printf("%s") dereferences whatever follows. On Android (arm64, build from current master) this segfaults in strlen inside vfprintf, so the player gets a crash instead of the intended "Property name 'x' is not supported" message and list.

Seen with two mods that target other engine builds: one calls openborvariant("cheats"), the other changeentityproperty(self, "nextforcedirection", ...). Both now log the error and shut down cleanly as designed.

The macro already receives the list length as MAXINDEX (the same value passed to searchList), so the loop stops there instead. One line, no behaviour change on the success path.

🤖 Generated with Claude Code

The unknown-property error path prints every valid name by walking the
list until it finds a NULL entry. None of the property lists end with
one, so the loop runs off the array and printf crashes in strlen. Use
MAXINDEX, the list length the macro already receives for searchList, as
the bound. Scripts that name a property from another engine build now
get the intended log message instead of a segfault.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MRinkl
MRinkl requested a review from DCurrent as a code owner September 22, 2026 10:24
@DCurrent
DCurrent merged commit 32f7c45 into DCurrent:master Sep 22, 2026
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.

3 participants