Page MenuHomeFreeBSD

Add explicit buffer bounds check and fix some functions
AbandonedPublic

Authored by markj on Jun 13 2025, 6:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 18, 7:35 AM
Unknown Object (File)
Mon, May 18, 7:35 AM
Unknown Object (File)
Wed, Apr 29, 6:50 AM
Unknown Object (File)
Tue, Apr 28, 12:52 PM
Unknown Object (File)
Mon, Apr 27, 6:20 PM
Unknown Object (File)
Sun, Apr 26, 1:42 PM
Unknown Object (File)
Sun, Apr 26, 12:20 PM
Unknown Object (File)
Sun, Apr 26, 12:05 PM
Subscribers

Details

Summary

This change adds explicit buffer bounds checks to functions that write strings into buffers, replacing unsafe operations such as strcpy with safer alternatives using size checks and std::copy. It also ensures section and segment names do not overflow their target fields and adds error handling for negative offsets. These changes address potential buffer overflow vulnerabilities and make the code robust against out-of-bounds memory access.

Test Plan

Run static analyzers (such as Snyk ,and my hands)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This isn't the right place to submit changes to llvm. This copy of llvm is imported from https://github.com/llvm/llvm-project and changes should be proposed there.

markj abandoned this revision.
markj added a reviewer: uncleruc2075_gmail.com.