Closed LocalSpook closed 3 months ago
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:
strncpy()
restrict
file_browser_reload_directory_content()
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.
memmove()
Found with Address Sanitizer.
strncpy()
's pointer parameters are markedrestrict
, but whenfile_browser_reload_directory_content()
was being called to reload the directory that was currently open: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.