Memcpy only when p_word is not NULL

enable -fsanitize=address
This commit is contained in:
Holger Vogt 2024-07-16 17:01:57 +02:00
parent 98479267d4
commit 272e4cc6fb
1 changed files with 2 additions and 1 deletions

View File

@ -606,7 +606,8 @@ wordlist_l *wll_cons(
if (opt & OPT_WLL_COPY_ALL) {
char *p_dst = w->wl.wl_word = TMALLOC(char, n_elem_word_alloc);
(void) memcpy(p_dst, p_word, n_char_word);
if(p_word)
(void) memcpy(p_dst, p_word, n_char_word);
p_dst += n_char_word;
*p_dst = '\0';
}