[vlc-devel] [PATCH 2/2] actions: Remove VLA usage

Alexandre Janniaux ajanni at videolabs.io
Thu Dec 10 17:26:06 CET 2020


Hi,

On Thu, Dec 10, 2020 at 05:15:27PM +0100, Hugo Beauzée-Luyssen wrote:
> ---
>  src/misc/actions.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/misc/actions.c b/src/misc/actions.c
> index ddbf04ad65..5b6e081f1c 100644
> --- a/src/misc/actions.c
> +++ b/src/misc/actions.c
> @@ -601,7 +601,8 @@ size_t
>  vlc_actions_get_keycodes(vlc_object_t *p_obj, const char *psz_key_name,
>                          bool b_global, uint_fast32_t **pp_keycodes)
>  {
> -    char varname[12 /* "global-key-" */ + strlen( psz_key_name )];
> +    assert(strlen( psz_key_name ) <= MAXACTION);
> +    char varname[12 /* "global-key-" */ + MAXACTION];

Since we wrote "global-key-" already, we can probably replace the
comment and 12 value by sizeof.

LGTM otherwise.

Regards,
--
Alexandre Janniaux
Videolabs

>      sprintf( varname, "%skey-%s", b_global ? "global-" : "", psz_key_name );
>
>      *pp_keycodes = NULL;
> --
> 2.29.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list