From c7419155d5b8aa1816dbce50bc7fe83b6eba4244 Mon Sep 17 00:00:00 2001 From: theraven Date: Mon, 10 Dec 2012 16:38:15 +0000 Subject: [PATCH] Add some explicit NULL checks in property introspection code. --- properties.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/properties.m b/properties.m index 2766cdf..2cde3fa 100644 --- a/properties.m +++ b/properties.m @@ -263,8 +263,8 @@ PRIVATE const char *constructPropertyAttributes(objc_property_t property, const char *name = (char*)property->name; const char *typeEncoding = property_getTypeEncoding(property); size_t typeSize = (NULL == typeEncoding) ? 0 : strlen(typeEncoding); - size_t nameSize = strlen(property->name); - size_t iVarNameSize = strlen(iVarName); + size_t nameSize = (NULL == name) ? 0 : strlen(name); + size_t iVarNameSize = (NULL == iVarName) ? 0 : strlen(iVarName); // Encoding is T{type},V{name}, so 4 bytes for the "T,V" that we always // need. We also need two bytes for the leading null and the length. size_t encodingSize = typeSize + nameSize + 6;