]> git.mdlowis.com Git - proto/labwc.git/commitdiff
buf.c: fix bug in environment variable expansion
authorJohan Malm <jgm323@gmail.com>
Fri, 15 Jul 2022 19:29:49 +0000 (20:29 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 15 Jul 2022 19:51:28 +0000 (21:51 +0200)
Allow underscore in environment variable names.

Closes issue #439

Helped-by: @Consolatis
...who both found the bug and told us how to fix it :)

src/common/buf.c

index e988860d69a65f7a7ec298fed226952dfff913da..f2e3b095212dd1d71a460baa8507194cf6896ef1 100644 (file)
@@ -28,7 +28,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';