4 Commits
Author SHA1 Message Date
Chad Attermann 1b12011507 Null termination of file name when max length
File names are returned unterminated in the edge case where their length
is max size This is due to the fact that strncpy does terminate the
destination string when the source string is greater than or equal to
the specifid maximum length.
2024-07-15 09:01:40 -06:00
Chad Attermann 236e434296 Additionally clearing pointers just in case
Clearing `_file` and `_dir` pointers after freeing on failure to open
just in case close() is later called.

To elaborate, the `_file` and `_dir` pointers are normally freed and
cleared by _close(), but when a failure occurs upon opening, these
pointers were being left orphaned since calling close() after failure to
open doesn't make much sense, and indeed caused serious issues within
lfs.
2024-07-12 13:18:40 -06:00
Chad Attermann cb212d0c3f Making new/delete operators overridable
Added `__attribute__((weak))` weak linking annotation to new and delete operator
overrides to allow for user-defined overrides.
2024-07-12 12:59:46 -06:00
Chad Attermann 1ce5cf13d2 Fix memory leak on failure to open
Fixes leak of memory caused by failure to free file and directory
structures when open fails.
2024-07-12 12:42:53 -06:00