If the idx is equal to or greater than SD_INODE_DATA_INDEX, it
will cause coredump.
Signed-off-by: Meng Lingkun <
mengl...@cmss.chinamobile.com>
---
dog/vdi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dog/vdi.c b/dog/vdi.c
index 4018087..f0e8a1c 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -268,6 +268,11 @@ static void print_obj_ref(uint32_t vid, const char *name, const char *tag,
uint64_t idx = data_oid_to_idx(oid);
struct get_vdi_info info;
+ if (idx >= SD_INODE_DATA_INDEX) {
+ sd_err("Failed to list: wrong oid %016"PRIx64"\n", oid);
+ exit(EXIT_FAILURE);
+ }
+
if (i->data_vdi_id[idx] != 0 &&
i->data_vdi_id[idx] == oid_to_vid(oid)) {
memset(&info, 0, sizeof(info));
--
1.8.3.1