Revert to the state after d7796855b879 and use the underlying buffer directly. I was still under the impression that was unsafe, so I did a drive-by fix, which this commit reverts.
PATH_MAX