[vlc-commits] remoteosd: fix useless copy, warning

Rémi Denis-Courmont git at videolan.org
Sun Feb 11 12:49:29 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 11 13:48:04 2018 +0200| [fc3ecc7ff535a2c8c1a1bbfd5e52d69582b5f05b] | committer: Rémi Denis-Courmont

remoteosd: fix useless copy, warning

../../modules/spu/remoteosd.c: In function ‘vnc_connect’:
../../modules/spu/remoteosd.c:363:5: warning: ‘strncpy’ output truncated before terminating nul copying 12 bytes from a string of the same length [-Wstringop-truncation]
     strncpy(pv, "RFB 003.003\n", sz_rfbProtocolVersionMsg);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

 modules/spu/remoteosd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/spu/remoteosd.c b/modules/spu/remoteosd.c
index d01812c4b1..a0396bbb82 100644
--- a/modules/spu/remoteosd.c
+++ b/modules/spu/remoteosd.c
@@ -360,9 +360,9 @@ static int vnc_connect( filter_t *p_filter )
 
     msg_Dbg( p_filter, "Server version is %s", pv );
 
-    strncpy(pv, "RFB 003.003\n", sz_rfbProtocolVersionMsg);
+    static const char version[sz_rfbProtocolVersionMsg] = "RFB 003.003\n";
 
-    if( !write_exact(p_filter, fd, pv, sz_rfbProtocolVersionMsg) )
+    if( !write_exact(p_filter, fd, version, sz_rfbProtocolVersionMsg) )
     {
         msg_Err( p_filter, "Could not write version message" );
         goto error;



More information about the vlc-commits mailing list