Adjusted the loop condition to use sizeof(extension) - 1 instead of -2, allowing the full extension to be copied while still ensuring space for a null terminator.
Initialized the extension buffer with zeros, removing the need for manual null termination after the loop.
Ensured the code handles edge cases such as the extension being at the start of the filename.
sizeof(extension) - 1
instead of-2
, allowing the full extension to be copied while still ensuring space for a null terminator.extension
buffer with zeros, removing the need for manual null termination after the loop.