From 134ed05e302efacf0089f807a287a068e39cae12 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Fri, 15 Jul 2022 20:29:49 +0100 Subject: [PATCH] buf.c: fix bug in environment variable expansion Allow underscore in environment variable names. Closes issue #439 Helped-by: @Consolatis ...who both found the bug and told us how to fix it :) Backport of fd7ec0ab95692dd7c9e8845c0786da149dc41dc1 --- src/common/buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/buf.c b/src/common/buf.c index 5e908f9a..55d96078 100644 --- a/src/common/buf.c +++ b/src/common/buf.c @@ -29,7 +29,7 @@ buf_expand_shell_variables(struct buf *s) environment_variable.len = 0; buf_add(&environment_variable, s->buf + i + 1); char *p = environment_variable.buf; - while (isalnum(*p) || *p == '{' || *p == '}') { + while (isalnum(*p) || *p == '_' || *p == '{' || *p == '}') { ++p; } *p = '\0';