2017-02-25 16:49 GMT+05:00 David Sommerseth <
open...@sf.lists.topphemmelig.net>:

> On 25/02/17 10:42, Илья Шипицин wrote:
> > there are two another unused functions in misc.c
> >
> > [src/openvpn/misc.c:661]: (style) The function 'env_set_print' is never
> > used.
>
> This one is useful for debugging purposes, so I let this one stay.  I
> did consider an #if 0 around it, to make it more explicit.  But I
> thought we have enough of those.  It could make some compiler warnings
> go away though disabling it.
>


it is good idea to put "#if 0" around debug items (that are not used
generally)

[src/openvpn/error.c:824]: (error) Null pointer dereference


>
> > [src/openvpn/misc.c:895]: (style) The function 'setenv_int_i' is never
> used.
>
> Ahh, that one I didn't check for.  I'll have a closer look if that is
> something we should let it survive or take that one out too.
>
> The most troubling issue with those two functions in the patch is that
> if they were to be used, it would actually make OpenVPN halt and exit
> due to the ASSERT() check not being fulfilled later on in the call
> chain.  setenv_str() calls setenv_str_ex() which checks if the pointer
> to a struct set_env is NULL or not.  If it is NULL, it stops.  And these
> two functions ends up calling setenv_str_ex() with
> struct env_set *es = NULL;
>
>
> --
> kind regards,
>
> David Sommerseth
> OpenVPN Technologies, Inc
>
>
> > 2017-02-25 7:02 GMT+05:00 David Sommerseth <dav...@openvpn.net
> > <mailto:dav...@openvpn.net>>:
> >
> >     The env_set_add_to_environmenti() and env_set_remove_from_
> environment()
> >     functions where not used in the code at all and they would cause an
> >     ASSERT() in setenv_str_ex() later on, as it would not allow the
> >     struct env_set *es pointer to be NULL (misc.c:807).
> >
> >     Signed-off-by: David Sommerseth <dav...@openvpn.net
> >     <mailto:dav...@openvpn.net>>
> >     ---
> >      src/openvpn/misc.c | 51
> >     ---------------------------------------------------
> >      src/openvpn/misc.h |  4 ----
> >      2 files changed, 55 deletions(-)
> >
> >     diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
> >     index a2f45b6..68d0687 100644
> >     --- a/src/openvpn/misc.c
> >     +++ b/src/openvpn/misc.c
> >     @@ -701,57 +701,6 @@ env_set_inherit(struct env_set *es, const
> >     struct env_set *src)
> >          }
> >      }
> >
> >     -void
> >     -env_set_add_to_environment(const struct env_set *es)
> >     -{
> >     -    if (es)
> >     -    {
> >     -        struct gc_arena gc = gc_new();
> >     -        const struct env_item *e;
> >     -
> >     -        e = es->list;
> >     -
> >     -        while (e)
> >     -        {
> >     -            const char *name;
> >     -            const char *value;
> >     -
> >     -            if (deconstruct_name_value(e->string, &name, &value,
> &gc))
> >     -            {
> >     -                setenv_str(NULL, name, value);
> >     -            }
> >     -
> >     -            e = e->next;
> >     -        }
> >     -        gc_free(&gc);
> >     -    }
> >     -}
> >     -
> >     -void
> >     -env_set_remove_from_environment(const struct env_set *es)
> >     -{
> >     -    if (es)
> >     -    {
> >     -        struct gc_arena gc = gc_new();
> >     -        const struct env_item *e;
> >     -
> >     -        e = es->list;
> >     -
> >     -        while (e)
> >     -        {
> >     -            const char *name;
> >     -            const char *value;
> >     -
> >     -            if (deconstruct_name_value(e->string, &name, &value,
> &gc))
> >     -            {
> >     -                setenv_del(NULL, name);
> >     -            }
> >     -
> >     -            e = e->next;
> >     -        }
> >     -        gc_free(&gc);
> >     -    }
> >     -}
> >
> >      /* add/modify/delete environmental strings */
> >
> >     diff --git a/src/openvpn/misc.h b/src/openvpn/misc.h
> >     index 16be621..009767f 100644
> >     --- a/src/openvpn/misc.h
> >     +++ b/src/openvpn/misc.h
> >     @@ -161,10 +161,6 @@ void env_set_print(int msglevel, const struct
> >     env_set *es);
> >
> >      void env_set_inherit(struct env_set *es, const struct env_set *src);
> >
> >     -void env_set_add_to_environment(const struct env_set *es);
> >     -
> >     -void env_set_remove_from_environment(const struct env_set *es);
> >     -
> >      /* Make arrays of strings */
> >
> >      const char **make_env_array(const struct env_set *es,
> >     --
> >     2.11.0
> >
> >
> >     ------------------------------------------------------------
> ------------------
> >     Check out the vibrant tech community on one of the world's most
> >     engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> >     _______________________________________________
> >     Openvpn-devel mailing list
> >     Openvpn-devel@lists.sourceforge.net
> >     <mailto:Openvpn-devel@lists.sourceforge.net>
> >     https://lists.sourceforge.net/lists/listinfo/openvpn-devel
> >     <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>
> >
> >
> >
> >
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> >
> >
> >
> > _______________________________________________
> > Openvpn-devel mailing list
> > Openvpn-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/openvpn-devel
> >
>
>
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to