]> Sergey Matveev's repositories - bfs.git/commitdiff
wordesc: Don't allow braces in bare words
authorTavian Barnes <tavianator@tavianator.com>
Wed, 18 Oct 2023 15:34:21 +0000 (11:34 -0400)
committerTavian Barnes <tavianator@tavianator.com>
Wed, 18 Oct 2023 15:34:21 +0000 (11:34 -0400)
Things like {a,b} should be quoted to avoid brace expansion.

src/bfstd.c

index a4ae4397cfd3042b6c4dae08073e054d61fa32ff..ace9ed27c5e9b891573166e7229f4ee572eeef16 100644 (file)
@@ -816,7 +816,7 @@ static char *dollar_quote(char *dest, char *end, const char *str, size_t len, en
 /** How much of this string is safe as a bare word? */
 static size_t bare_len(const char *str, size_t len) {
        // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02
-       size_t ret = strcspn(str, "|&;<>()$`\\\"' *?[#˜=%!");
+       size_t ret = strcspn(str, "|&;<>()$`\\\"' *?[#˜=%!{}");
        return ret < len ? ret : len;
 }