diff mbox

[1/5] Use KF_PATH to verify the size of a struct kinfo_file.

Message ID 20180908003659.37482-2-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin Sept. 8, 2018, 12:36 a.m. UTC
fbsd_core_vnode_path needs to use the offset of the kf_path member of
struct kinfo_file as the minimum size of a struct kinfo_file object.
However, it was using KVE_PATH instead due to a copy and paste bug.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
	KVE_PATH.
---
 gdb/ChangeLog   | 5 +++++
 gdb/fbsd-tdep.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Simon Marchi Sept. 8, 2018, 10:24 p.m. UTC | #1
On 2018-09-08 01:36 AM, John Baldwin wrote:
> fbsd_core_vnode_path needs to use the offset of the kf_path member of
> struct kinfo_file as the minimum size of a struct kinfo_file object.
> However, it was using KVE_PATH instead due to a copy and paste bug.
> 
> gdb/ChangeLog:
> 
> 	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
> 	KVE_PATH.
> ---
>  gdb/ChangeLog   | 5 +++++
>  gdb/fbsd-tdep.c | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index e6f44a3ac2..d32b390778 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2018-09-07  John Baldwin  <jhb@FreeBSD.org>
> +
> +	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
> +	KVE_PATH.
> +
>  2018-09-06  Simon Ser  <contact@emersion.fr>
>  
>  	PR gdb/23105
> diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
> index ed43087169..9e6d7276c4 100644
> --- a/gdb/fbsd-tdep.c
> +++ b/gdb/fbsd-tdep.c
> @@ -781,12 +781,12 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
>    /* Skip over the structure size.  */
>    descdata += 4;
>  
> -  while (descdata + KVE_PATH < descend)
> +  while (descdata + KF_PATH < descend)
>      {
>        ULONGEST structsize;
>  
>        structsize = bfd_get_32 (core_bfd, descdata + KF_STRUCTSIZE);
> -      if (structsize < KVE_PATH)
> +      if (structsize < KF_PATH)
>  	error (_("malformed core note - vmmap entry too small"));
>  
>        if (bfd_get_32 (core_bfd, descdata + KF_TYPE) == KINFO_FILE_TYPE_VNODE
> 


LGTM.

Simon
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e6f44a3ac2..d32b390778 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-09-07  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
+	KVE_PATH.
+
 2018-09-06  Simon Ser  <contact@emersion.fr>
 
 	PR gdb/23105
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index ed43087169..9e6d7276c4 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -781,12 +781,12 @@  fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
   /* Skip over the structure size.  */
   descdata += 4;
 
-  while (descdata + KVE_PATH < descend)
+  while (descdata + KF_PATH < descend)
     {
       ULONGEST structsize;
 
       structsize = bfd_get_32 (core_bfd, descdata + KF_STRUCTSIZE);
-      if (structsize < KVE_PATH)
+      if (structsize < KF_PATH)
 	error (_("malformed core note - vmmap entry too small"));
 
       if (bfd_get_32 (core_bfd, descdata + KF_TYPE) == KINFO_FILE_TYPE_VNODE