Module Name: src Committed By: kre Date: Mon Mar 20 11:48:01 UTC 2017
Modified Files: src/bin/sh: expand.c Log Message: PR bin/52090 - fix expansion of unquoted $* To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/bin/sh/expand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/expand.c diff -u src/bin/sh/expand.c:1.103 src/bin/sh/expand.c:1.104 --- src/bin/sh/expand.c:1.103 Mon Mar 20 11:26:07 2017 +++ src/bin/sh/expand.c Mon Mar 20 11:48:01 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: expand.c,v 1.103 2017/03/20 11:26:07 kre Exp $ */ +/* $NetBSD: expand.c,v 1.104 2017/03/20 11:48:01 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; #else -__RCSID("$NetBSD: expand.c,v 1.103 2017/03/20 11:26:07 kre Exp $"); +__RCSID("$NetBSD: expand.c,v 1.104 2017/03/20 11:48:01 kre Exp $"); #endif #endif /* not lint */ @@ -947,8 +947,13 @@ numvar: sep = ifsval()[0]; for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { STRTODEST(p); - if (*ap && sep) + if (!*ap) + break; + if (sep) STPUTC(sep, expdest); + else if ((flag & (EXP_FULL|EXP_IN_QUOTES)) == EXP_FULL + && !quoted && **ap != '\0') + STPUTC('\0', expdest); } break; case '0':