[git commit] hush: fix a signedness bug

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 30 22:48:18 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=6ffaa00338a9dc5f9e798c30aa9f96e51ab2ef36
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Testcase:

set -- a ""; space=" "; printf "<%s>\n" "$@"$space

Before:
<a >
After:
<a>
<>

It usually does not bite since bbox forces -funsigned-char build.

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell/hush.c b/shell/hush.c
index e6dd1bc3d..01d8f5935 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6126,7 +6126,7 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg)
 			} else
 			/* If EXP_FLAG_SINGLEWORD, we handle assignment 'a=....$@.....'
 			 * and in this case should treat it like '$*' - see 'else...' below */
-			if (first_ch == ('@'|0x80)  /* quoted $@ */
+			if (first_ch == (char)('@'|0x80)  /* quoted $@ */
 			 && !(output->o_expflags & EXP_FLAG_SINGLEWORD) /* not v="$@" case */
 			) {
 				while (1) {


More information about the busybox-cvs mailing list