fix char buffer size and don't rely on PATH_MAX, it's nearly useless