From 2a3502b086a5656514e8abab95ea69fd27e4db56 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Mon, 15 Aug 2016 18:43:06 -0400 Subject: WT-2840 clang analysis: garbage values (#2963) Check the WT_ITEM.size value is > 0 before indirecting to an invalid offset. --- src/cursor/cur_metadata.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cursor/cur_metadata.c b/src/cursor/cur_metadata.c index 9111afcc801..fd00acdf0ab 100644 --- a/src/cursor/cur_metadata.c +++ b/src/cursor/cur_metadata.c @@ -155,8 +155,9 @@ err: __wt_free(session, value); * but also check for the internal version of the URI. */ #define WT_KEY_IS_METADATA(key) \ + ((key)->size > 0 && \ (WT_STRING_MATCH(WT_METADATA_URI, (key)->data, (key)->size - 1) ||\ - WT_STRING_MATCH(WT_METAFILE_URI, (key)->data, (key)->size - 1)) + WT_STRING_MATCH(WT_METAFILE_URI, (key)->data, (key)->size - 1))) /* * __curmetadata_metadata_search -- -- cgit v1.2.1