aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/hush.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 415993e71..238f997da 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5730,14 +5730,17 @@ static char *encode_then_expand_string(const char *str)
5730 char *exp_str; 5730 char *exp_str;
5731 struct in_str input; 5731 struct in_str input;
5732 o_string dest = NULL_O_STRING; 5732 o_string dest = NULL_O_STRING;
5733 const char *cp;
5733 5734
5734 if (!strchr(str, '$') 5735 cp = str;
5735 && !strchr(str, '\\') 5736 for (;;) {
5737 if (!*cp) return NULL; /* string has no special chars */
5738 if (*cp == '$') break;
5739 if (*cp == '\\') break;
5736#if ENABLE_HUSH_TICK 5740#if ENABLE_HUSH_TICK
5737 && !strchr(str, '`') 5741 if (*cp == '`') break;
5738#endif 5742#endif
5739 ) { 5743 cp++;
5740 return NULL;
5741 } 5744 }
5742 5745
5743 /* We need to expand. Example: 5746 /* We need to expand. Example:
@@ -5768,17 +5771,19 @@ static char *encode_then_expand_vararg(const char *str, int handle_squotes, int
5768 char *exp_str; 5771 char *exp_str;
5769 struct in_str input; 5772 struct in_str input;
5770 o_string dest = NULL_O_STRING; 5773 o_string dest = NULL_O_STRING;
5774 const char *cp;
5771 5775
5772 if (!strchr(str, '$') 5776 cp = str;
5773 && !strchr(str, '\\') 5777 for (;;) {
5774 && !strchr(str, '\'') 5778 if (!*cp) return NULL; /* string has no special chars */
5775//todo:better code 5779 if (*cp == '$') break;
5776 && !strchr(str, '"') 5780 if (*cp == '\\') break;
5781 if (*cp == '\'') break;
5782 if (*cp == '"') break;
5777#if ENABLE_HUSH_TICK 5783#if ENABLE_HUSH_TICK
5778 && !strchr(str, '`') 5784 if (*cp == '`') break;
5779#endif 5785#endif
5780 ) { 5786 cp++;
5781 return NULL;
5782 } 5787 }
5783 5788
5784 /* Expanding ARG in ${var#ARG}, ${var%ARG}, or ${var/ARG/ARG}. 5789 /* Expanding ARG in ${var#ARG}, ${var%ARG}, or ${var/ARG/ARG}.