remove the empty string case in random-pathname

it's covered in generate_random_page
clamp the range of the pathname to the allocation
make sure there's room in the buffer for pushing the extra 2 chars
fix another case where we need to make sure we have room in the buffer