Commit Graph

4 Commits

Author SHA1 Message Date
Pieter-Jan Briers a6376368ee String safety (#1548)
* Array size UB fixes

* Fix ShieldD

* Remove (almost) all unsafe strcpy calls

Bunch of macros. C arrays are easy enough and just need a different call. For various cases where a char* is passed around bare, I've made a TEXT_SPAN macro that can store a length too for bounds checking.

* Move crash handling in safe string operations to separate TU

* strcat safe version

* sprintf made safe too

* Fix compile
2026-05-24 10:43:00 -06:00
PJB3005 5d24e1125f Re-add src == dst check in SafeStringCopyTruncate
Accidentally dropped this while iterating on the exact implementation.
2026-03-27 17:17:45 +01:00
PJB3005 a2b32c27c0 Do use strncpy in SafeStringCopy
I figured out how to mute the warnings.
2026-03-27 17:16:41 +01:00
PJB3005 abfe917008 Add replacement helpers for strncpy[_s]
Portable without vulnerabilities.
2026-03-27 16:54:51 +01:00