diff options
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm_file2.c | 7 | ||||
-rw-r--r-- | lib/libkvm/kvm_proc2.c | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/libkvm/kvm_file2.c b/lib/libkvm/kvm_file2.c index 0df59df095a..2af3d7702fa 100644 --- a/lib/libkvm/kvm_file2.c +++ b/lib/libkvm/kvm_file2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_file2.c,v 1.14 2010/01/10 03:37:50 guenther Exp $ */ +/* $OpenBSD: kvm_file2.c,v 1.15 2010/06/29 16:39:23 guenther Exp $ */ /* * Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com> @@ -172,6 +172,11 @@ kvm_getfile2(kvm_t *kd, int op, int arg, size_t esize, int *cnt) *cnt = size / esize; return ((struct kinfo_file2 *)kd->filebase); } else { + if (esize > sizeof(struct kinfo_file2)) { + _kvm_syserr(kd, kd->program, + "kvm_getfile2: unknown fields requested: libkvm out of date?"); + return (NULL); + } deadway: switch (op) { case KERN_FILE_BYFILE: diff --git a/lib/libkvm/kvm_proc2.c b/lib/libkvm/kvm_proc2.c index 7e3fb8b863b..00e7f774dec 100644 --- a/lib/libkvm/kvm_proc2.c +++ b/lib/libkvm/kvm_proc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_proc2.c,v 1.1 2010/01/10 03:37:50 guenther Exp $ */ +/* $OpenBSD: kvm_proc2.c,v 1.2 2010/06/29 16:39:23 guenther Exp $ */ /* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -330,6 +330,12 @@ kvm_getproc2(kvm_t *kd, int op, int arg, size_t esize, int *cnt) struct proc *p; char *bp; + if (esize > sizeof(struct kinfo_proc2)) { + _kvm_syserr(kd, kd->program, + "kvm_getproc2: unknown fields requested: libkvm out of date?"); + return (NULL); + } + memset(nl, 0, sizeof(nl)); nl[0].n_name = "_nprocs"; nl[1].n_name = "_allproc"; |