mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Fix possible future overflow in zfs_nicenum
The function zfs_nicenum that converts number to human-readable output uses a index to a string of letters. This patch limits the index to the length of the string. Signed-off-by: Christer Ekholm <che@chrekh.se> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3122
This commit is contained in:
parent
b4f3666a16
commit
8bdcfb5396
@ -571,7 +571,7 @@ zfs_nicenum(uint64_t num, char *buf, size_t buflen)
|
||||
int index = 0;
|
||||
char u;
|
||||
|
||||
while (n >= 1024) {
|
||||
while (n >= 1024 && index < 6) {
|
||||
n /= 1024;
|
||||
index++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user