]> git.sur5r.net Git - openldap/commitdiff
Don't underflow malloc'd memory in hdb_fix_dn()
authorHoward Chu <hyc@openldap.org>
Fri, 1 May 2009 04:26:44 +0000 (04:26 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 1 May 2009 04:26:44 +0000 (04:26 +0000)
servers/slapd/back-bdb/dn2id.c

index 7a022db165fcc72d51d6ca613b4dbe2dd6815a85..f4c528fa48646e8b31dfc0f44bbe321b0765ea2f 100644 (file)
@@ -529,8 +529,8 @@ int hdb_fix_dn(
                }
        }
        BEI(e)->bei_modrdns = max;
-       ptr[-1] = '\0';
-       nptr[-1] = '\0';
+       if ( ptr > e->e_name.bv_val ) ptr[-1] = '\0';
+       if ( nptr > e->e_nname.bv_val ) nptr[-1] = '\0';
 
        return 0;
 }