Integer Overflow in sprintf Buffer
This commit is contained in:
@ -31,7 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Logic
|
// Logic
|
||||||
// #define DRYRUN // don't touch the drives
|
#define DRYRUN // don't touch the drives
|
||||||
#define FROZEN_ALERT // show alert if drive is frozen
|
#define FROZEN_ALERT // show alert if drive is frozen
|
||||||
#define ZERO_CHECK // check drive after shred if all bytes are zero, show alert if this fails
|
#define ZERO_CHECK // check drive after shred if all bytes are zero, show alert if this fails
|
||||||
|
|
||||||
|
|||||||
@ -62,8 +62,8 @@ string Drive::sCapacityToText()
|
|||||||
dSize /= 1000;
|
dSize /= 1000;
|
||||||
u16UnitIndex++;
|
u16UnitIndex++;
|
||||||
}
|
}
|
||||||
|
int precision = (u16UnitIndex >= 3) ? (u16UnitIndex - 3) : 0;
|
||||||
sprintf(acBuffer, "%.*f %s", u16UnitIndex - 3, dSize, units[u16UnitIndex]);
|
sprintf(acBuffer, "%.*f %s", precision, dSize, units[u16UnitIndex]);
|
||||||
return acBuffer;
|
return acBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user