support null buffer argument to getcwd, auto-allocating behavior