The inet_pton function needs an input string with a final \0. This function copies the input string to a temporary buffer, adds the final \0 and converts to address.