[vlc-devel] [PATCH V2] network: http auth: Remove VLA usages
Romain Vimont
rom1v at videolabs.io
Fri Dec 11 00:19:01 CET 2020
Le 10 décembre 2020 17:35:21 GMT+01:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> 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 )
It might be better to name the function differently from the macro.
> {
>- 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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list