summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-02-23 21:01:23 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-02-23 21:01:23 +0000
commitcb8993229c78f5a3b0dec134d04f66d29995ef04 (patch)
treeeac28b79dc410911bc9795d4e76f0e44427942ae
parentb4bc528dc6788bdc60a6ef5faa3f67dae5a2fe62 (diff)
make sure we don't backwards before buffer
-rw-r--r--usr.sbin/procmap/procmap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c
index 14773ae0b2c..2242c9baf34 100644
--- a/usr.sbin/procmap/procmap.c
+++ b/usr.sbin/procmap/procmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procmap.c,v 1.13 2004/02/23 20:53:21 tedu Exp $ */
+/* $OpenBSD: procmap.c,v 1.14 2004/02/23 21:01:22 tedu Exp $ */
/* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */
/*
@@ -780,6 +780,8 @@ findname(kvm_t *kd, struct kbit *vmspace,
l = strlen(D(vfs, mount)->mnt_stat.f_mntonname);
switch (search_cache(kd, vp, &name, buf, sizeof(buf))) {
case 0: /* found something */
+ if (name - (1 + 11 + l) < buf)
+ break;
name--;
*name = '/';
/*FALLTHROUGH*/
@@ -791,6 +793,8 @@ findname(kvm_t *kd, struct kbit *vmspace,
D(vfs, mount)->mnt_stat.f_mntonname, l);
break;
case 1: /* all is well */
+ if (name - (1 + l) < buf)
+ break;
name--;
*name = '/';
if (l != 1) {