Convert strlen(getrateunitprefix(...)) explicit to int as it is safe to be small
UBSan complains:
src/misc.c:312:4: runtime error: implicit conversion from type 'unsigned long' of value
18446744073709551610 (64-bit, unsigned) to type 'int' changed the value to -6 (32-bit, signed)
Found by clang's UndefinedBehaviorSanitizer
/* tune spacing according to unit */
/* +1 for space between number and unit */
- l -= strlen(getunitprefix(index)) + 1;
+ l -= (int) strlen(getunitprefix(index)) + 1;
if (l < 0) {
l = 1;
}
{
int l = len;
- l -= strlen(getrateunitprefix(unitmode, unitindex)) + 1;
+ l -= (int) strlen(getrateunitprefix(unitmode, unitindex)) + 1;
if (l < 0) {
l = 1;
}