Source-Changes-HG archive

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

[src/trunk]: src/bin/sh prevent sign extension from making expression always ...



details:   https://anonhg.NetBSD.org/src/rev/02a0fa348451
branches:  trunk
changeset: 1004123:02a0fa348451
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 13 20:55:04 2019 +0000

description:
prevent sign extension from making expression always false.

diffstat:

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

diffs (34 lines):

diff -r 7ca981a4f75f -r 02a0fa348451 bin/sh/expand.c
--- a/bin/sh/expand.c   Sun Oct 13 20:43:25 2019 +0000
+++ b/bin/sh/expand.c   Sun Oct 13 20:55:04 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.134 2019/10/08 03:53:57 kre Exp $ */
+/*     $NetBSD: expand.c,v 1.135 2019/10/13 20:55:04 christos 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.134 2019/10/08 03:53:57 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.135 2019/10/13 20:55:04 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -268,12 +268,13 @@
                        return p - 1;
                case CTLENDVAR: /* end of expanding yyy in ${xxx-yyy} */
                case CTLENDARI: /* end of a $(( )) string */
-                       if (had_dol_at && (*p&0xFF) == CTLQUOTEEND)
+                       if (had_dol_at &&
+                           (*p & 0xff) == (unsigned char)CTLQUOTEEND)
                                p++;
                        NULLTERM_4_TRACE(expdest);
                        VTRACE(DBG_EXPAND, ("argstr returning at \"%.6s\"..."
                            " after %2.2X; added \"%s\" to expdest\n",
-                           p, (c&0xff), stackblock()));
+                           p, (c & 0xff), stackblock()));
                        return p;
                case CTLQUOTEMARK:
                        /* "$@" syntax adherence hack */



Home | Main Index | Thread Index | Old Index