If readlink copies sizeof(buf) characters then we have no '\0' so we must restrict it to copy only sizeof(buf)-1.