From 4c9645b555c2560535551ee4f12300594b1b28b2 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Fri, 5 May 2017 17:18:50 +0800 Subject: [PATCH] blobstore: Add the size check of length field in desc_xattr Change-Id: I522b29b3a603b1e83c866486d036137ee4fafcbd Signed-off-by: Ziye Yang --- lib/blob/blobstore.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 130821d2c..7cbae698d 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -221,6 +221,10 @@ _spdk_blob_parse_page(const struct spdk_blob_md_page *page, struct spdk_blob *bl desc_xattr = (struct spdk_blob_md_descriptor_xattr *)desc; + assert(desc_xattr->length == sizeof(desc_xattr->name_length) + + sizeof(desc_xattr->value_length) + + desc_xattr->name_length + desc_xattr->value_length); + xattr = calloc(1, sizeof(*xattr)); assert(xattr != NULL);