aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0029-fix-bad-character-checking-in-wordexp.patch
blob: 861608af9474686283957b85234a521c65a9721a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 594ffed82f4e6ee7da85e9c5da35e32946ae32c9 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Wed, 11 Feb 2015 01:37:01 -0500
Subject: [PATCH] fix bad character checking in wordexp

the character sequence '$((' was incorrectly interpreted as the
opening of arithmetic even within single-quoted contexts, thereby
suppressing the checks for bad characters after the closing quote.

presently bad character checking is only performed when the WRDE_NOCMD
is used; this patch only corrects checking in that case.
---
 src/misc/wordexp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c
index a5f1b65..db39b5b 100644
--- a/src/misc/wordexp.c
+++ b/src/misc/wordexp.c
@@ -77,6 +77,7 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags)
 		if (!(sq|dq|np)) return WRDE_BADCHAR;
 		break;
 	case '$':
+		if (sq) break;
 		if (s[i+1]=='(' && s[i+2]=='(') {
 			i += 2;
 			np += 2;
-- 
2.3.3