ср, 17 мая 2023 г. в 22:47, Antonio Quartulli <a...@unstable.cc>:

> Hi,
>
> On 17/05/2023 22:01, Ilya Shipitsin wrote:
> > malloc was not checked against NULL, I was able
> > to get core dump in case of failure
> >
> > Signed-off-by: Ilya Shipitsin <chipits...@gmail.com>
> > ---
> >   src/openvpn/dco_freebsd.c | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
> > index 1111abeb..adbd1120 100644
> > --- a/src/openvpn/dco_freebsd.c
> > +++ b/src/openvpn/dco_freebsd.c
> > @@ -594,6 +594,11 @@ dco_available(int msglevel)
> >       }
> >
> >       buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
> > +    if (buf == NULL)
>
> as style guideline, we wanted to go for if (!A) rather than if (A ==
> NULL). Although I am not sure if the whole codebase was cleaned up yet
> or not.
>

I'm fine with either :)


>
> Cheers,
>
> > +    {
> > +        close(fd);
> > +        return false;
> > +    }
> >
> >       ifcr.ifcr_count = ifcr.ifcr_total;
> >       ifcr.ifcr_buffer = buf;
>
> --
> Antonio Quartulli
>
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to