]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use KF_PATH to verify the size of a struct kinfo_file.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 18 Sep 2018 21:05:47 +0000 (14:05 -0700)
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.

While here, fix another copy and paste bug in the error message for a
truncated kinfo_file object.

gdb/ChangeLog:

* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
KVE_PATH.

gdb/ChangeLog
gdb/fbsd-tdep.c

index 328d48eeeb945802541254c94eac0eefc0e06993..2d9316f62cde44c08fad2e08fd512c70b267d222 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-18  John Baldwin  <jhb@FreeBSD.org>
+
+       * fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
+       KVE_PATH.
+
 2018-09-18  Tom Tromey  <tom@tromey.com>
 
        * compile/compile-object-load.c (struct
index ed430871693bc863cbd48dd00b318251b2fcb500..48544b5370f3a4bad723c2bc677aa6f88c328950 100644 (file)
@@ -781,13 +781,13 @@ 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)
-       error (_("malformed core note - vmmap entry too small"));
+      if (structsize < KF_PATH)
+       error (_("malformed core note - file structure too small"));
 
       if (bfd_get_32 (core_bfd, descdata + KF_TYPE) == KINFO_FILE_TYPE_VNODE
          && bfd_get_signed_32 (core_bfd, descdata + KF_FD) == fd)