Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh PR bin/52272 - fix an off-by one that broke ~ expansi...



details:   https://anonhg.NetBSD.org/src/rev/454ccf8e50b6
branches:  trunk
changeset: 824427:454ccf8e50b6
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Jun 04 23:40:31 2017 +0000

description:
PR bin/52272 - fix an off-by one that broke ~ expansions.

diffstat:

 bin/sh/expand.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r b60a989f6191 -r 454ccf8e50b6 bin/sh/expand.c
--- a/bin/sh/expand.c   Sun Jun 04 23:34:55 2017 +0000
+++ b/bin/sh/expand.c   Sun Jun 04 23:40:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.110 2017/06/03 21:52:05 kre Exp $ */
+/*     $NetBSD: expand.c,v 1.111 2017/06/04 23:40:31 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.110 2017/06/03 21:52:05 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.111 2017/06/04 23:40:31 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -321,7 +321,7 @@
        char *user;
 
        user = expdest;         /* we will just borrow top of stack */
-       while ((c = *p) != '\0') {
+       while ((c = *++p) != '\0') {
                switch(c) {
                case CTLESC:
                case CTLVAR:
@@ -339,7 +339,6 @@
                        goto done;
                }
                STPUTC(c, user);
-               p++;
        }
  done:
        STACKSTRNUL(user);



Home | Main Index | Thread Index | Old Index