reds: Replace strncpy with g_strlcpy

strncpy is considered unsafe

Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Pavel Grunt 2016-11-18 13:25:24 +01:00 committed by Frediano Ziglio
parent c52da2fec5
commit 5554b1ec95
2 changed files with 1 additions and 2 deletions

1
cfg.mk
View File

@ -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 \

View File

@ -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) {