From 066a588c1427d4dfa0e8b2899624d7bb2dc80d52 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 8 Sep 2010 15:24:29 -0700 Subject: [PATCH] crushtool: fix bucket type array bound check --- src/crushtool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crushtool.cc b/src/crushtool.cc index ba4dc57d68d9f..44854a25b8dd9 100644 --- a/src/crushtool.cc +++ b/src/crushtool.cc @@ -850,7 +850,7 @@ int main(int argc, const char **argv) crush.set_type_name(type, l.name); int buckettype = -1; - for (int i = 0; i < (int)sizeof(bucket_types); i++) + for (int i = 0; i < (int)(sizeof(bucket_types)/sizeof(bucket_types[0])); i++) if (strcmp(l.buckettype, bucket_types[i].name) == 0) { buckettype = bucket_types[i].type; break; -- 2.39.5