[Spice-commits] server/red-stream-device.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 30 15:19:22 UTC 2019


 server/red-stream-device.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 70a724be6ea85ef4d564c49ddbb1c7f724fd0a75
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jan 30 15:12:54 2019 +0000

    red-stream-device: Fix "make syntax-check"
    
    Avoid using strncpy, considered not secure.
    In this case a simple memcpy is used, we are going to terminate
    the string in any case on the next line.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Lukáš Hrázký <lhrazky at redhat.com>

diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 440b2689..2a210cc7 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -330,9 +330,9 @@ handle_msg_device_display_info(StreamDevice *dev, SpiceCharDeviceInstance *sin)
         return true;
     }
 
-    strncpy(dev->device_display_info.device_address,
-            (char*) display_info_msg->device_address,
-            device_address_len);
+    memcpy(dev->device_display_info.device_address,
+           (char*) display_info_msg->device_address,
+           device_address_len);
 
     // make sure the string is terminated
     dev->device_display_info.device_address[device_address_len - 1] = '\0';


More information about the Spice-commits mailing list