Skip to content

pr 12-15 T1anjiu - #16

Merged
michael105 merged 8 commits into
masterfrom
master_test
Aug 31, 2026
Merged

michael105 merged 8 commits into
masterfrom
master_test

Conversation

@michael105

Copy link
Copy Markdown
Owner

pointer/memory corruption fixes

1 and others added 8 commits July 30, 2026 02:36
- Fixed incorrect 2D array cast to 1D pointer array
- Changed from pointer iteration to proper 2D array indexing
- Prevents setenv() crash when NULL is passed as value
- Tested: program starts without crash, environment variables set correctly
- Increased buffer size from [last-data] to [last-data + 1]
- from_utf8() writes null terminator after data, needs extra byte
- Prevents 1-byte stack overflow when pasting UTF-8 content
- Tested: buffer allocation now matches actual write size
- Changed revfg, revbg, truefg, truebg from local to static variables
- Prevents undefined behavior when caller dereferences returned pointer
- Eliminates compiler warning: [-Wreturn-local-addr]
- Tested: compiles cleanly without warnings
- Changed boundary check from BETWEEN(x, 0, arraylen) to arraylen-1
- Prevents heap overflow when x equals arraylen (e.g., x=256)
- Can be triggered remotely via OSC 4 control sequences
- Tested: x=256 is now correctly rejected
Fix : Correct export_env array iteration in system.c
Fix : Prevent array overflow in xsetcolorname
Fix : Prevent stack overflow in clipboard paste
Fix : Prevent returning stack address in xdrawglyphfontspecs
@michael105
michael105 merged commit 36e46f5 into master Aug 31, 2026
1 check passed
@michael105
michael105 deleted the master_test branch August 31, 2026 02:20
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