[vlc-devel] [PATCH] control: rc: avoid stringop-truncation warning

Rémi Denis-Courmont remi at remlab.net
Mon Jan 20 08:38:46 CET 2020


OK, though I'd suggest removing Unix socket support entirely as the old RC "protocol" is not suitable for programmatic usage.

Le 19 janvier 2020 17:39:27 GMT+02:00, Alexandre Janniaux <ajanni at videolabs.io> a écrit :
>Fortify enabled implies a warning if we use strncpy with a length equal
>to the buffer size. As we fill the last item with a null character, we
>can use length-1 instead as well.
>---
> modules/control/rc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/modules/control/rc.c b/modules/control/rc.c
>index cd85602d59..dc37d352ad 100644
>--- a/modules/control/rc.c
>+++ b/modules/control/rc.c
>@@ -1730,7 +1730,7 @@ static int Activate( vlc_object_t *p_this )
>         }
> 
>         addr.sun_family = AF_LOCAL;
>-        strncpy( addr.sun_path, psz_unix_path, sizeof( addr.sun_path )
>);
>+        strncpy( addr.sun_path, psz_unix_path, sizeof( addr.sun_path )
>- 1 );
>         addr.sun_path[sizeof( addr.sun_path ) - 1] = '\0';
> 
>         if (bind (i_socket, (struct sockaddr *)&addr, sizeof (addr))
>-- 
>2.25.0
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200120/5a3edf4f/attachment.html>


More information about the vlc-devel mailing list