[PATCH] get_interfaces() return early causes segfault in winbind

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Oct 25 18:52:05 UTC 2018


On Thu, Oct 25, 2018 at 12:46:34PM -0600, David Mulder via samba-technical wrote:
> How about this instead:
> 
>     above */
>  int get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
>  {
> -       struct iface_struct *ifaces;
> +       struct iface_struct *ifaces = NULL;
>         int total, i, j;
>  
>         total = _get_interfaces(mem_ctx, &ifaces);
>         /* If we have an error, no interface or just one we can leave */
>         if (total <= 1) {
> +               *pifaces = ifaces;
>                 return total;
>         }
>  
> Initialize ifaces to NULL, then always set pifaces to ifaces? The
> initialization is necessary since _get_interfaces() returns without
> changing ifaces if there are no interfaces.

If it works -- even better!

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de



More information about the samba-technical mailing list