]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#3420
authorHoward Chu <hyc@openldap.org>
Tue, 7 Dec 2004 08:48:28 +0000 (08:48 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 7 Dec 2004 08:48:28 +0000 (08:48 +0000)
servers/slapd/sl_malloc.c

index 021f85bb8fc8bf51d927d2223f7b6b05109d7cad..b7a40644301287c112907c146707c57fa2bb1c20 100644 (file)
@@ -376,7 +376,8 @@ slap_sl_realloc(void *ptr, ber_len_t size, void *ctx)
                        new = p;
        
                /* If reallocing the last block, we can grow it */
-               } else if ((char *)ptr + p[-1] == sh->sh_last) {
+               } else if ((char *)ptr + p[-1] == sh->sh_last &&
+                       (char *)ptr + size < (char *)sh->sh_end ) {
                        new = p;
                        sh->sh_last = (char *)sh->sh_last + size - p[-1];
                        p[-1] = size;