mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
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
This commit is contained in:
parent
31914882fc
commit
c78f449d85
@ -1345,7 +1345,7 @@ static int
|
||||
readhash(FILE *f, int flags)
|
||||
{
|
||||
int i, t, space;
|
||||
int sum;
|
||||
unsigned sum;
|
||||
|
||||
sum = 1;
|
||||
space = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user