[vlc-commits] network: http auth: Remove VLA usages

Hugo Beauzée-Luyssen git at videolan.org
Mon Dec 14 13:10:52 UTC 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 10 17:31:28 2020 +0100| [1e56827c79b662cec37c580d596630412ebeca68] | committer: Hugo Beauzée-Luyssen

network: http auth: Remove VLA usages

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e56827c79b662cec37c580d596630412ebeca68
---

 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 )
     {



More information about the vlc-commits mailing list