瀏覽代碼

Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166

https://bugzilla.redhat.com/show_bug.cgi?id=611790
Resolves: bug 611790
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
Fix description: Catch possible NULL pointer in send_specific_attrs().
Endi S. Dewata 15 年之前
父節點
當前提交
9dfdafc392
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ldap/servers/slapd/result.c

+ 2 - 2
ldap/servers/slapd/result.c

@@ -1060,7 +1060,7 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
 			vattr_flags |= SLAPI_VIRTUALATTRS_ONLY;
 	}
 	
-	for ( i = 0; attrs[i] != NULL; i++ )
+	for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ )
 	{
 		char *current_type_name = attrs[i];
         if(!dontsendattr[i]) {
@@ -1130,7 +1130,7 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
 					 * returned (since it will also trigger the return of the less
 					 * generic attribute subtypes.
 					 */
-					for ( j = i+1; attrs != NULL && attrs[j] != NULL && dontsendattr[i]==0; j++ )
+					for ( j = i+1; attrs[j] != NULL && dontsendattr[i]==0; j++ )
 					{
 						if ( !dontsendattr[j] && slapi_attr_type_cmp( attrs[j], actual_type_name[iter], SLAPI_TYPE_CMP_SUBTYPE ) == 0 )
 						{