Module Name:    src
Committed By:   kamil
Date:           Tue Jun 12 14:13:55 UTC 2018

Modified Files:
        src/bin/ksh: eval.c

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/eval.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/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.24 src/bin/ksh/eval.c:1.25
--- src/bin/ksh/eval.c:1.24	Sun Jun  3 16:09:31 2018
+++ src/bin/ksh/eval.c	Tue Jun 12 14:13:55 2018
@@ -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(cp, wp, f)
 	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;
 

Reply via email to