[vlc-devel] [PATCH] network: http auth: Remove VLA usages
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Fri Dec 11 09:37:23 CET 2020
---
src/network/http_auth.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/network/http_auth.c b/src/network/http_auth.c
index 599fda6286..76f91fe7d9 100644
--- a/src/network/http_auth.c
+++ b/src/network/http_auth.c
@@ -42,10 +42,9 @@
/*****************************************************************************
* "RFC 2617: Basic and Digest Access Authentication" header parsing
*****************************************************************************/
-static char *AuthGetParam( const char *psz_header, const char *psz_param )
+#define AuthGetParam( HEADER, PARAM ) AuthGetParamConcat( HEADER, PARAM "=\"" )
+static char *AuthGetParamConcat( const char *psz_header, const char *psz_what )
{
- char psz_what[strlen(psz_param)+3];
- sprintf( psz_what, "%s=\"", psz_param );
psz_header = strstr( psz_header, psz_what );
if ( psz_header )
{
@@ -62,10 +61,9 @@ static char *AuthGetParam( const char *psz_header, const char *psz_param )
}
}
-static char *AuthGetParamNoQuotes( const char *psz_header, const char *psz_param )
+#define AuthGetParamNoQuotes( HEADER, PARAM ) AuthGetParamNoQuotesConcat( HEADER, PARAM "=" )
+static char *AuthGetParamNoQuotesConcat( const char *psz_header, const char *psz_what )
{
- char psz_what[strlen(psz_param)+2];
- sprintf( psz_what, "%s=", psz_param );
psz_header = strstr( psz_header, psz_what );
if ( psz_header )
{
--
2.29.2
More information about the vlc-devel
mailing list