[vlc-devel] [PATCH 05/12] misc: message: Remove VLA usage

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


Same as 1 and much worse in this sensitive code path.

-1

Le 8 décembre 2020 16:19:09 GMT+02:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> src/misc/messages.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/src/misc/messages.c b/src/misc/messages.c
>index 898e4be56f..7e5bcc00e3 100644
>--- a/src/misc/messages.c
>+++ b/src/misc/messages.c
>@@ -95,9 +95,12 @@ void vlc_vaLog(struct vlc_logger *const *loggerp,
>int type,
>     p = strchr(module, '.');
> 
>     size_t modlen = (p != NULL) ? (p - module) : 0;
>-    char modulebuf[modlen + 1];
>+    char *modulebuf = NULL;
>     if (p != NULL)
>     {
>+        modulebuf = malloc(modlen + 1);
>+        if (!modulebuf)
>+            return;
>         memcpy(modulebuf, module, modlen);
>         modulebuf[modlen] = '\0';
>         module = modulebuf;
>@@ -126,6 +129,7 @@ void vlc_vaLog(struct vlc_logger *const *loggerp,
>int type,
>     /* Pass message to the callback */
>     if (logger != NULL)
>         vlc_vaLogCallback(logger, type, &msg, format, args);
>+    free(modulebuf);
> }
> 
> void vlc_Log(struct vlc_logger *const *logger, int type,
>-- 
>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/15a1aa6c/attachment.html>


More information about the vlc-devel mailing list