The doc also says: "Note: This function does not append a null character to the array."

Therefore, you need + 1 to add the terminating NULL character (see my comment below).