diff --git a/CHANGES b/CHANGES
index c997dd92d11cea6cb0d21a3f04478bab1ec85e7d..96885ccd567c5be9304ce0fb99ab3f72e9d25a6c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,7 @@ OpenLDAP 2.4.24 Engineering
 	Fixed slapd-bdb entry cache delete failure (ITS#6577)
 	Fixed slapd-null back-config support (ITS#6624)
 	Fixed slapo-pcache callback freeing (ITS#6640)
+	Fixed slapo-pcache to ignore undefined attrs (ITS#6600)
 	Fixed slapo-ppolicy don't update opattrs on consumers (ITS#6608)
 	Fixed slapo-syncprov to send error if consumer is newer (ITS#6606)
 
diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c
index 88b90c3a32ece82d6bbbeda632cf83f1d1bad343..26e28e7de9656c6ce506bc9a823e2e80cfd18cf6 100644
--- a/servers/slapd/overlays/pcache.c
+++ b/servers/slapd/overlays/pcache.c
@@ -3122,19 +3122,30 @@ get_attr_set(
 	query_manager* qm,
 	int num )
 {
-	int i;
+	int i = 0;
 	int count = 0;
 
 	if ( attrs ) {
-		for ( ; attrs[count].an_name.bv_val; count++ );
+		for ( ; attrs[i].an_name.bv_val; i++ ) {
+			/* only count valid attribute names
+			 * (searches ignore others, this overlay does the same) */
+			if ( attrs[i].an_desc ) {
+				count++;
+			}
+		}
 	}
 
-	/* recognize a single "*" or a "1.1" */
-	if ( count == 0 ) {
+	/* recognize default or explicit single "*" */
+	if ( ! attrs ||
+		( i == 1 && bvmatch( &attrs[0].an_name, slap_bv_all_user_attrs ) ) )
+	{
 		count = 1;
 		attrs = slap_anlist_all_user_attributes;
 
-	} else if ( count == 1 && bvmatch( &attrs[0].an_name, slap_bv_no_attrs ) ) {
+	/* recognize implicit (no valid attributes) or explicit single "1.1" */
+	} else if ( count == 0 ||
+		( i == 1 && bvmatch( &attrs[0].an_name, slap_bv_no_attrs ) ) )
+	{
 		count = 0;
 		attrs = NULL;
 	}
@@ -3155,6 +3166,8 @@ get_attr_set(
 		}
 
 		for ( a2 = attrs; a2->an_name.bv_val; a2++ ) {
+			if ( !a2->an_desc && !bvmatch( &a2->an_name, slap_bv_all_user_attrs ) ) continue;
+
 			if ( !an_find( qm->attr_sets[i].attrs, &a2->an_name ) ) {
 				found = 0;
 				break;