[vlc-devel] [PATCH] http_auth: fix -Wstringop-truncation warning

Thomas Guillem thomas at gllm.fr
Tue May 5 15:03:27 CEST 2020


Hello,

On Mon, May 4, 2020, at 19:38, Alexandre Janniaux wrote:
> The size of hashes are fixed so there is no need for str functions, as
> otherwise strncpy complains about having the destination size equal to
> the given size with fortify.
> ---
>  src/network/http_auth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/network/http_auth.c b/src/network/http_auth.c
> index 4d49978ac97..599fda6286d 100644
> --- a/src/network/http_auth.c
> +++ b/src/network/http_auth.c
> @@ -125,7 +125,7 @@ static char *AuthDigest( vlc_object_t *p_this, 
> vlc_http_auth_t *p_auth,
>      /* H(A1) */
>      if ( p_auth->psz_HA1 )
>      {
> -        strncpy( psz_HA1, p_auth->psz_HA1, sizeof(psz_HA1) );
> +        memcpy( psz_HA1, p_auth->psz_HA1, sizeof(psz_HA1) );

I'm curious, why not using strcpy in that case?

>      }
>      else
>      {
> -- 
> 2.26.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