Remove the usage of PATH_MAX in tests.

Replace static PATH_MAX-sized buffers with dynamically allocated strings.