From 81ef7a98166cdae97336c5143fceb3eb5a661136 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Thu, 14 Jul 2016 15:10:47 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20fail=20the=20test=20if=20we=20g?= =?UTF-8?q?et=20more=20attributes=20than=20we=20expect.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attribute lists are not null-terminated, so this would previously have gone off into memory that it was not meant to access. --- Test/PropertyIntrospectionTest2_arc.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/PropertyIntrospectionTest2_arc.m b/Test/PropertyIntrospectionTest2_arc.m index 3ec266f..506c59d 100644 --- a/Test/PropertyIntrospectionTest2_arc.m +++ b/Test/PropertyIntrospectionTest2_arc.m @@ -281,7 +281,7 @@ static BOOL testPropertyForProperty_alt(objc_property_t p, attrsList = property_copyAttributeList(p, NULL); OPT_ASSERT(0 != attrsList); objc_property_attribute_t *ra; - for (attrsCount = 0, ra = attrsList; ra->name != NULL; attrsCount++, ra++) {} + for (attrsCount = 0, ra = attrsList; (ra->name != NULL) && (attrsCount < size); attrsCount++, ra++) {} OPT_ASSERT(attrsCount == size); free(attrsList); for (unsigned int index=0; index