Fix off-by-one for terminating directory names.

This was harmless, as a terminating null is added afterwards anyway as part of the data structure. But it was alarming to see in Valgrind.