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>
This commit is contained in:
kamil 2018-06-12 14:13:55 +00:00
parent 463be44101
commit d6d5f49c60

View File

@ -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;