[PATCH spice] reds: Replace strncpy with g_strlcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



strncpy is considered unsafe
---
 cfg.mk        | 1 -
 server/reds.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 66235ee..3e5d345 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -42,7 +42,6 @@ local-checks-to-skip =			\
   sc_prohibit_stat_st_blocks		\
   sc_prohibit_magic_number_exit         \
   sc_prohibit_strcmp                    \
-  sc_prohibit_strncpy                   \
   sc_prohibit_undesirable_word_seq      \
   sc_root_tests				\
   sc_space_tab				\
diff --git a/server/reds.c b/server/reds.c
index 92feea1..0e68973 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2504,7 +2504,7 @@ static int reds_init_socket(const char *addr, int portnr, int family)
         }
 
         local.sun_family = AF_UNIX;
-        strncpy(local.sun_path, addr, sizeof(local.sun_path) -1);
+        g_strlcpy(local.sun_path, addr, sizeof(local.sun_path));
         unlink(local.sun_path);
         len = SUN_LEN(&local);
         if (bind(slisten, (struct sockaddr *)&local, len) == -1) {
-- 
2.10.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]