Print this page
6638 ::pfiles walks out of bounds on array of vnode types
@@ -526,11 +526,11 @@
return (0);
}
const struct fs_type {
- int type;
+ vtype_t type;
const char *name;
} fs_types[] = {
{ VNON, "NON" },
{ VREG, "REG" },
{ VDIR, "DIR" },
@@ -945,13 +945,15 @@
mdb_warn("failed to read vnode");
return (DCMD_ERR);
}
type = "?";
- for (i = 0; i <= NUM_FS_TYPES; i++) {
- if (fs_types[i].type == v.v_type)
+ for (i = 0; i < NUM_FS_TYPES; i++) {
+ if (fs_types[i].type == v.v_type) {
type = fs_types[i].name;
+ break;
+ }
}
do {
uintptr_t next_realvpp;