[vlc-devel] [PATCH V2] network: http auth: Remove VLA usages
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Dec 10 17:35:21 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..dfdbade414 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 ) AuthGetParam( HEADER, PARAM "=\"" )
+static char *(AuthGetParam)( 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 ) AuthGetParamNoQuotes( HEADER, PARAM "=" )
+static char *(AuthGetParamNoQuotes)( 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