Changed buffers that are appended to from MAX_PATH to an arbitrary 512 bytes. This can still crash, but it would take a ridiculously long path + file combination. A better future fix would use dynamic strings (such as std::string) instead of static buffers.