ext: ensure path is a valid C string