mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Fix buffer underflow if sysfs file is empty
Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Jason Lee <jasonlee@lanl.gov> Signed-off-by: Robert Evans <evansr@google.com> Closes #16028 Closes #16035
This commit is contained in:
parent
cfb96c772b
commit
2553f94c42
@ -458,7 +458,7 @@ static char *zpool_sysfs_gets(char *path)
|
||||
}
|
||||
|
||||
/* Remove trailing newline */
|
||||
if (buf[count - 1] == '\n')
|
||||
if (count > 0 && buf[count - 1] == '\n')
|
||||
buf[count - 1] = 0;
|
||||
|
||||
close(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user