[vlc-devel] [PATCH 04/12] filter_chain: Avoid VLA
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Tue Dec 8 15:19:08 CET 2020
---
src/misc/filter_chain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 82068f3ff2..0806be2566 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -251,9 +251,11 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
/* Append the "chain" video filter to the current list.
* This filter will be used if the requested filter fails to load.
* It will then try to add a video converter before. */
- char name_chained[strlen(name) + sizeof(",chain")];
- sprintf( name_chained, "%s,chain", name );
+ char* name_chained;
+ if (asprintf(&name_chained, "%s,chain", name) < 0)
+ goto error;
filter->p_module = module_need( filter, capability, name_chained, true );
+ free(name_chained);
}
else
filter->p_module = module_need( filter, capability, name, name != NULL );
--
2.29.2
More information about the vlc-devel
mailing list