diff options
author | markj <markj@FreeBSD.org> | 2014-04-14 00:24:04 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2014-04-14 00:24:04 +0000 |
commit | efaf328cf593e0da0109f9a7487e285651f6365f (patch) | |
tree | 0409dcf8db85dd31f85c5bdf4499fd8743dea027 /lib | |
parent | 42a27d59d58e00a81a6fbe0c2538be9825bf55ca (diff) | |
download | FreeBSD-src-efaf328cf593e0da0109f9a7487e285651f6365f.zip FreeBSD-src-efaf328cf593e0da0109f9a7487e285651f6365f.tar.gz |
Fix some off-by-one errors. The kve_end and rdl_eaddr fields contain the
first address after the end of the map entry and should therefore be
excluded.
MFC after: 2 weeks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libproc/proc_sym.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c index f848040..2338895 100644 --- a/lib/libproc/proc_sym.c +++ b/lib/libproc/proc_sym.c @@ -96,7 +96,7 @@ proc_objname(struct proc_handle *p, uintptr_t addr, char *objname, for (i = 0; i < p->nobjs; i++) { rdl = &p->rdobjs[i]; - if (addr >= rdl->rdl_saddr && addr <= rdl->rdl_eaddr) { + if (addr >= rdl->rdl_saddr && addr < rdl->rdl_eaddr) { strlcpy(objname, rdl->rdl_path, objnamesz); return (objname); } @@ -176,7 +176,7 @@ proc_addr2map(struct proc_handle *p, uintptr_t addr) kve = kves + i; if (kve->kve_type == KVME_TYPE_VNODE) lastvn = i; - if (addr >= kve->kve_start && addr <= kve->kve_end) { + if (addr >= kve->kve_start && addr < kve->kve_end) { if ((map = malloc(sizeof(*map))) == NULL) { free(kves); return (NULL); @@ -209,7 +209,7 @@ proc_addr2map(struct proc_handle *p, uintptr_t addr) for (i = 0; i < p->nobjs; i++) { rdl = &p->rdobjs[i]; - if (addr >= rdl->rdl_saddr && addr <= rdl->rdl_eaddr) { + if (addr >= rdl->rdl_saddr && addr < rdl->rdl_eaddr) { if ((map = malloc(sizeof(*map))) == NULL) return (NULL); proc_rdl2prmap(rdl, map); |