Parcourir la source

Bug 609590 - fix coverity Defect Type: Memory - corruptions issues

https://bugzilla.redhat.com/show_bug.cgi?id=609590
Resolves: bug 609590
Bug Description: fix coverity Defect Type: Memory - corruptions issues
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: ACLPB_MAX_ATTR_LEN is the buffer size including the trailing
null, not the strlen.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Rich Megginson il y a 15 ans
Parent
commit
858f45f80f
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      ldap/servers/plugins/acl/acl.c

+ 2 - 2
ldap/servers/plugins/acl/acl.c

@@ -1039,9 +1039,9 @@ acl_read_access_allowed_on_entry (
 			** sending
 			*/
 			len = strlen(attr_type);
-			if ( len > ACLPB_MAX_ATTR_LEN) {
+			if ( (len + 1) > ACLPB_MAX_ATTR_LEN) {
 				slapi_ch_free ( (void **) &aclpb->aclpb_Evalattr);
-				aclpb->aclpb_Evalattr = slapi_ch_malloc(len);
+				aclpb->aclpb_Evalattr = slapi_ch_malloc(len+1);
 			}
 			PL_strncpyz (aclpb->aclpb_Evalattr, attr_type, len);
 			if ( attr_index >= 0 ) {