From 8762512fdb088acefb9f3ea5f7b1e1bf2d336ff3 Mon Sep 17 00:00:00 2001 From: Rostislav Skudnov Date: Wed, 1 Feb 2017 18:35:13 +0000 Subject: Replace int -> uint to avoid signed integer overflow An example of such an error (should be compiled with DEBUG_SANITIZE): runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Rostislav Skudnov Signed-off-by: Denys Vlasenko --- libbb/pw_encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libbb/pw_encrypt.c') diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c index 4cdc2de76..fe06a8fe6 100644 --- a/libbb/pw_encrypt.c +++ b/libbb/pw_encrypt.c @@ -30,7 +30,7 @@ static int i64c(int i) int FAST_FUNC crypt_make_salt(char *p, int cnt /*, int x */) { /* was: x += ... */ - int x = getpid() + monotonic_us(); + unsigned x = getpid() + monotonic_us(); do { /* x = (x*1664525 + 1013904223) % 2^32 generator is lame * (low-order bit is not "random", etc...), -- cgit v1.2.3