Validate that the supplied file is not empty before trying mmap(2) it
and access the pages associated with it. Submitted by: Wojciech A. Koszek PR: bin/91411 MFC after: 1 week
This commit is contained in:
parent
4f56714639
commit
4c05286a61
@ -179,6 +179,11 @@ _kvm_open(kd, uf, mf, flag, errout)
|
||||
_kvm_syserr(kd, kd->program, "%s", mf);
|
||||
goto failed;
|
||||
}
|
||||
if (S_ISREG(st.st_mode) && st.st_size <= 0) {
|
||||
errno = EINVAL;
|
||||
_kvm_syserr(kd, kd->program, "empty file");
|
||||
goto failed;
|
||||
}
|
||||
if (fcntl(kd->pmfd, F_SETFD, FD_CLOEXEC) < 0) {
|
||||
_kvm_syserr(kd, kd->program, "%s", mf);
|
||||
goto failed;
|
||||
|
Loading…
Reference in New Issue
Block a user