diff options
author | ngie <ngie@FreeBSD.org> | 2016-05-13 08:54:08 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-05-13 08:54:08 +0000 |
commit | b8862d73f093e6f41ef3b125aeffec576f42a924 (patch) | |
tree | c1ff700a0dfd58752dc18f83183cddcb1a0b7c4d /lib/libkvm/kvm_proc.c | |
parent | 96ce93c4effd8c3892503e3afbfe6f1b7b694cdf (diff) | |
download | FreeBSD-src-b8862d73f093e6f41ef3b125aeffec576f42a924.zip FreeBSD-src-b8862d73f093e6f41ef3b125aeffec576f42a924.tar.gz |
MFC r298671,r298672:
r298671 (by cem):
g_part_bsd64: Check for valid on-disk npartitions value
This value is u32 on disk, but assigned to an int in memory. After we do the
implicit conversion via assignment, check that the result is at least one[1]
(non-negative[2]).
1. The subsequent for-loop iterates from gpt_entries minus one, down, until
reaching zero. A negative or zero initial index results in undefined signed
integer overflow.
2. It is also used to index into arrays later.
In practice, we expected non-malicious disks to contain small positive values.
CID: 1223202
r298672 (by cem):
g_part_bsd64: Delete duplicate/dead code
RAW_PART is handled earlier in the loop.
CID: 1223201
Diffstat (limited to 'lib/libkvm/kvm_proc.c')
0 files changed, 0 insertions, 0 deletions