Source-Changes-HG archive

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

[src/trunk]: src/bin/ksh Change typ of tilde_ok from int to unsigned int in k...



details:   https://anonhg.NetBSD.org/src/rev/a4a542457055
branches:  trunk
changeset: 319806:a4a542457055
user:      kamil <kamil%NetBSD.org@localhost>
date:      Tue Jun 12 14:13:55 2018 +0000

description:
Change typ of tilde_ok from int to unsigned int in ksh(1)

UBSan can detect that during switching a login to root there is unportable
left shift operation:

$ su -
Password:
/public/src.git/bin/ksh/eval.c:598:13: runtime error: left shift of 1073741824 by 1 places cannot be represented in type 'int'
#

Sponsored by <The NetBSD Foundation>

diffstat:

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

diffs (28 lines):

diff -r 3c9c77b65269 -r a4a542457055 bin/ksh/eval.c
--- a/bin/ksh/eval.c    Tue Jun 12 13:24:28 2018 +0000
+++ b/bin/ksh/eval.c    Tue Jun 12 14:13:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $  */
+/*     $NetBSD: eval.c,v 1.25 2018/06/12 14:13:55 kamil Exp $  */
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.25 2018/06/12 14:13:55 kamil Exp $");
 #endif
 
 #include <sys/stat.h>
@@ -173,7 +173,8 @@
        Expand x;               /* expansion variables */
        SubType st_head, *st;
        int UNINITIALIZED(newlines); /* For trailing newlines in COMSUB */
-       int saw_eq, tilde_ok;
+       int saw_eq;
+       unsigned int tilde_ok;
        int make_magic;
        size_t len;
 



Home | Main Index | Thread Index | Old Index