I'll have a look, thanks!

On Mon, Sep 9, 2024, 09:30 Gert Doering <g...@greenie.muc.de> wrote:

> Hi,
>
> On Mon, Jul 08, 2024 at 11:08:20PM +0200, Ilia Shipitsin wrote:
> >      multi->auth_token = strdup((char *)BPTR(&session_token));
> > +    if (!multi->auth_token)
> > +    {
> > +        msg( M_FATAL, "Failed allocate memory for multi->auth_token");
> > +    }
>
> I do wonder if this is the right approach here.  For "openvpn itself"
> we have the check_malloc_return() macro, which will purposely not call
> msg() - as msg() does internal malloc()s, and if we cannot allocate
> 20 bytes for an auth_token, the chance that msg() will not succeed is
> fairly high...
>
> In plugins or unit tests, the infrastructure is different, but for 3/ and
> 4/, please resend with
>
>       multi->auth_token = strdup((char *)BPTR(&session_token));
>  +    check_malloc_return(multi->auth_token);
>
> (etc)
>
> gert
> --
> "If was one thing all people took for granted, was conviction that if you
>  feed honest figures into a computer, honest figures come out. Never
> doubted
>  it myself till I met a computer with a sense of humor."
>                              Robert A. Heinlein, The Moon is a Harsh
> Mistress
>
> Gert Doering - Munich, Germany
> g...@greenie.muc.de
>
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to