From 58787756d442e74efefc31cf73a4dd439fb8e357 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 16 Jul 2024 16:06:54 +0200 Subject: [PATCH] memcpy only if p_word is not NULL --- src/frontend/parser/glob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/parser/glob.c b/src/frontend/parser/glob.c index 2a1566cc3..49287cbd0 100644 --- a/src/frontend/parser/glob.c +++ b/src/frontend/parser/glob.c @@ -604,7 +604,7 @@ wordlist_l *wll_cons( w->n_char_word = n_char_word; w->n_elem_word_alloc = n_elem_word_alloc; - if (opt & OPT_WLL_COPY_ALL) { + if (p_word && 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); p_dst += n_char_word;