summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-12-16 23:52:28 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-12-16 23:57:12 +0100
commitcde7c781e172c1fd55f74550b66712540a677d85 (patch)
tree74d820cb6ca3e38d09077059e0346260b3534865 /kern
parent1bb1ba65cb9efceeb20b4296f903f3fe58b3341e (diff)
kern: gracefully handle bogus sample pc sequence number
If a sequence number larger than the sample control sequence number is supplied, `nsamples' becomes negative. Handle this gracefully. * kern/pc_sample.c (get_sampled_pcs): Handle bogus sequence number.
Diffstat (limited to 'kern')
-rw-r--r--kern/pc_sample.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 81b2056..fcb9d71 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -189,6 +189,9 @@ get_sampled_pcs(
(sampled_pc_array_t)cp->buffer,
(seqidx2 + 1) * sizeof(sampled_pc_t));
}
+ } else if (nsamples < 0) {
+ /* Bogus SEQNO supplied. */
+ nsamples = 0;
} else {
/* could either be zero because of overflow, or because
* we are being lied to. In either case, return nothing.