Skip to content

Fix libc edge-case correctness bugs#122

Merged
stikonas merged 8 commits into
oriansj:mainfrom
siraben:siraben/top-level-libc-fixes
May 14, 2026
Merged

Fix libc edge-case correctness bugs#122
stikonas merged 8 commits into
oriansj:mainfrom
siraben:siraben/top-level-libc-fixes

Conversation

@siraben
Copy link
Copy Markdown
Contributor

@siraben siraben commented May 14, 2026

Fix several libc edge cases that can write past caller buffers, copy past a shrunk allocation, leave unterminated strings, or continue after failed stream allocation.

The most important fixes cover fgets, vsnprintf, strncpy, strnlen_s, memmove, realloc, setenv, fread, and failed fopen/fdopen setup. Reduced versions of the old code were validated with GCC AddressSanitizer/UBSan, which reproduced the buffer overflows, NULL write, and missing-return issues.

@gtker
Copy link
Copy Markdown
Contributor

gtker commented May 14, 2026

@stikonas @oriansj

@stikonas stikonas merged commit b8bb2a0 into oriansj:main May 14, 2026
@siraben siraben deleted the siraben/top-level-libc-fixes branch May 15, 2026 00:53
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