ws2_32: Fix allocating a hostent with no h_aliases list.

Alexandre Julliard julliard at winehq.org
Mon Dec 14 05:26:01 CST 2009


Erich Hoover <ehoover at mines.edu> writes:

> @@ -4616,11 +4620,18 @@ static struct WS_hostent *WS_create_he(char *name, int aliases, int addresses, i
>                  sizeof(char *)*aliases +
>                  sizeof(char *)*addresses);
>  
> -    /* Place addresses in the allocated memory, making sure to have enough
> -     * room for the NULL at the end of the list.
> +    /* NOTE: Even if the alias and address lists are "empty" the list pointer must
> +     * be non-NULL and contain a single NULL item.
>       */
> +    if (aliases == 0 || addresses == 0)
> +    {
> +        FIXME("Cannot create a hostent with an empty list pointer!\n");
> +        return NULL;
> +    }

That's an internal constraint in the code, it doesn't make sense to have
a FIXME. If you really want a check it should be an assert().

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list