Nuklear
Nuklear copied to clipboard
Fix undefined behavior in `strncpy()` call
strncpy()
's pointer parameters are marked restrict
, but when file_browser_reload_directory_content()
was being called to reload the directory that was currently open:
file_browser_reload_directory_content(browser, browser->directory)
it would try to copy its path buffer to itself, causing undefined behavior. The solution uses memmove()
, which can handle overlapping pointers.
Found with Address Sanitizer.