From 272e4cc6fb4611ced8af2a1e3f7952d1ba373489 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 16 Jul 2024 17:01:57 +0200 Subject: [PATCH] Memcpy only when p_word is not NULL enable -fsanitize=address --- src/frontend/parser/glob.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/parser/glob.c b/src/frontend/parser/glob.c index 2a1566cc3..f30bd7586 100644 --- a/src/frontend/parser/glob.c +++ b/src/frontend/parser/glob.c @@ -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'; }