s4:subtree_rename LDB module - introduce out of memory checks
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 1 Aug 2010 09:05:26 +0000 (11:05 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 1 Aug 2010 12:00:10 +0000 (14:00 +0200)
source4/dsdb/samdb/ldb_modules/subtree_rename.c

index 590f6f76803675b85192d4fae5e0ab09980ad7d9..094a9c64425309ec5da8c6d606a481e0d2d37b1f 100644 (file)
@@ -156,7 +156,9 @@ static int check_system_flags(struct ldb_message *msg,
        }
 
        dn1 = ldb_dn_get_parent(ac, olddn);
+       if (dn1 == NULL) return ldb_oom(ldb);
        dn2 = ldb_dn_get_parent(ac, newdn);
+       if (dn2 == NULL) return ldb_oom(ldb);
 
        if (ldb_dn_compare(dn1, dn2) == 0) {
                rename_op = true;
@@ -184,7 +186,9 @@ static int check_system_flags(struct ldb_message *msg,
 
                        if (limited_move) {
                                dn1 = ldb_dn_copy(ac, olddn);
+                               if (dn1 == NULL) return ldb_oom(ldb);
                                dn2 = ldb_dn_copy(ac, newdn);
+                               if (dn2 == NULL) return ldb_oom(ldb);
 
                                limited_move &= ldb_dn_remove_child_components(dn1, 3);
                                limited_move &= ldb_dn_remove_child_components(dn2, 3);