aboutsummaryrefslogtreecommitdiff
path: root/shell/match.h
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-26 11:25:19 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-26 11:25:19 +0000
commit5b7589eb27e748a3d281c0341219cf7435e8b4f1 (patch)
treeb9565d8d331207ed37a3b9c0f654b500839d8ef6 /shell/match.h
parent80e57eb7d525803bb776e8294483141756b2b2ef (diff)
downloadbusybox-w32-5b7589eb27e748a3d281c0341219cf7435e8b4f1.tar.gz
busybox-w32-5b7589eb27e748a3d281c0341219cf7435e8b4f1.tar.bz2
busybox-w32-5b7589eb27e748a3d281c0341219cf7435e8b4f1.zip
hush: fix SEGV in % expansion
function old new delta expand_variables 2203 2217 +14
Diffstat (limited to '')
-rw-r--r--shell/match.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/shell/match.h b/shell/match.h
index 3fc4de340..90597ee54 100644
--- a/shell/match.h
+++ b/shell/match.h
@@ -2,12 +2,12 @@
2 2
3PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 3PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
4 4
5typedef char *(*scan_t)(char *string, char *match, bool zero); 5typedef char *(*scan_t)(char *string, char *match, bool match_at_left);
6 6
7char *scanleft(char *string, char *match, bool zero); 7char *scanleft(char *string, char *match, bool match_at_left);
8char *scanright(char *string, char *match, bool zero); 8char *scanright(char *string, char *match, bool match_at_left);
9 9
10static inline scan_t pick_scan(char op1, char op2, bool *zero) 10static inline scan_t pick_scan(char op1, char op2, bool *match_at_left)
11{ 11{
12 /* # - scanleft 12 /* # - scanleft
13 * ## - scanright 13 * ## - scanright
@@ -15,10 +15,10 @@ static inline scan_t pick_scan(char op1, char op2, bool *zero)
15 * %% - scanleft 15 * %% - scanleft
16 */ 16 */
17 if (op1 == '#') { 17 if (op1 == '#') {
18 *zero = true; 18 *match_at_left = true;
19 return op1 == op2 ? scanright : scanleft; 19 return op1 == op2 ? scanright : scanleft;
20 } else { 20 } else {
21 *zero = false; 21 *match_at_left = false;
22 return op1 == op2 ? scanleft : scanright; 22 return op1 == op2 ? scanleft : scanright;
23 } 23 }
24} 24}