Properly NUL terminate expanded path by memsetting it.