[vlc-devel] [PATCH 02/12] actions: Avoid VLA

Rémi Denis-Courmont remi at remlab.net
Tue Dec 8 16:05:54 CET 2020


Same as 1

-1

Le 8 décembre 2020 16:19:06 GMT+02:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> src/misc/actions.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/src/misc/actions.c b/src/misc/actions.c
>index b10b07936e..58bb64c3bc 100644
>--- a/src/misc/actions.c
>+++ b/src/misc/actions.c
>@@ -601,12 +601,14 @@ 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 )];
>-    sprintf( varname, "%skey-%s", b_global ? "global-" : "",
>psz_key_name );
>+    char* varname;
>+    if (asprintf(&varname, "%skey-%s", b_global ? "global-" : "",
>psz_key_name) < 0)
>+        return 0;
> 
>     *pp_keycodes = NULL;
> 
>     char *psz_keys = var_InheritString( p_obj, varname );
>+    free(varname);
>     if( psz_keys == NULL )
>         return 0;
> 
>-- 
>2.29.2
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20201208/cc5a99c7/attachment.html>


More information about the vlc-devel mailing list