diff --git a/CHANGES b/CHANGES
index d355e2f381feced0dcc0ffbc96a13631e3fb69da..d71e3a594e91c012f0e562ea79b37445cab383b3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log
 
 OpenLDAP 2.4.20 Engineering
 	Fixed libldap uninitialized return value (ITS#6355)
+	Fixed liblutil constant (ITS#5909)
 	Fixed slapd inclusion of ac/unistd.h (ITS#6342)
 	Fixed slapd debug handling of LDAP_DEBUG_ANY (ITS#6324)
 	Fixed slapd termination for one level dns (ITS#6338)
diff --git a/libraries/liblutil/tavl.c b/libraries/liblutil/tavl.c
index 519b169911597b105feedd1bee17d2c24da5747c..a6a2bf4a5f88049850d340d6ded3cc9f948a748a 100644
--- a/libraries/liblutil/tavl.c
+++ b/libraries/liblutil/tavl.c
@@ -21,6 +21,7 @@
 
 #include "portable.h"
 
+#include <limits.h>
 #include <stdio.h>
 #include <ac/stdlib.h>
 
@@ -35,6 +36,9 @@
 #define AVL_INTERNAL
 #include "avl.h"
 
+/* Maximum tree depth this host's address space could support */
+#define MAX_TREE_DEPTH	(sizeof(void *) * CHAR_BIT)
+
 static const int avl_bfs[] = {LH, RH};
 
 /*
@@ -189,8 +193,8 @@ tavl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
 	int side, side_bf, shorter, nside = -1;
 
 	/* parent stack */
-	Avlnode *pptr[sizeof(void *)*8];
-	unsigned char pdir[sizeof(void *)*8];
+	Avlnode *pptr[MAX_TREE_DEPTH];
+	unsigned char pdir[MAX_TREE_DEPTH];
 	int depth = 0;
 
 	if ( *root == NULL )