usr.bin/diff: fix UBSan error in readhash

UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By:	imp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31075

(cherry picked from commit c78f449d85)
This commit is contained in:
Alex Richardson 2021-07-06 12:16:40 +01:00
parent 608cb96312
commit 7a7324d9ce
1 changed files with 1 additions and 1 deletions

View File

@ -1345,7 +1345,7 @@ static int
readhash(FILE *f, int flags)
{
int i, t, space;
int sum;
unsigned sum;
sum = 1;
space = 0;