diff options
author | Ron Yorston <rmy@pobox.com> | 2014-12-14 14:20:56 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-12-14 14:20:56 +0000 |
commit | 6d6d18d45c145899fce3a39553771cf0af671f30 (patch) | |
tree | 1936d18cbf61b9e0989464aad0a11c52cbeff7b7 /shell/ash.c | |
parent | 0c204dc07b718244c360e0b84df66ce0a012e14f (diff) | |
parent | acb8be721768b54075a51d1859d390904a0f1f6c (diff) | |
download | busybox-w32-6d6d18d45c145899fce3a39553771cf0af671f30.tar.gz busybox-w32-6d6d18d45c145899fce3a39553771cf0af671f30.tar.bz2 busybox-w32-6d6d18d45c145899fce3a39553771cf0af671f30.zip |
Merge branch 'busybox' into merge
Conflicts:
archival/libarchive/open_transformer.c
libbb/lineedit.c
miscutils/man.c
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3f3e2f4bc..b95356034 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6740,7 +6740,15 @@ subevalvar(char *p, char *varname, int strloc, int subtype, | |||
6740 | len = number(loc); | 6740 | len = number(loc); |
6741 | } | 6741 | } |
6742 | } | 6742 | } |
6743 | if (pos >= orig_len) { | 6743 | if (pos < 0) { |
6744 | /* ${VAR:$((-n)):l} starts n chars from the end */ | ||
6745 | pos = orig_len + pos; | ||
6746 | } | ||
6747 | if ((unsigned)pos >= orig_len) { | ||
6748 | /* apart from obvious ${VAR:999999:l}, | ||
6749 | * covers ${VAR:$((-9999999)):l} - result is "" | ||
6750 | * (bash-compat) | ||
6751 | */ | ||
6744 | pos = 0; | 6752 | pos = 0; |
6745 | len = 0; | 6753 | len = 0; |
6746 | } | 6754 | } |