summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldapd/attributes.c
diff options
context:
space:
mode:
authormartinh <martinh@openbsd.org>2010-07-13 12:54:51 +0000
committermartinh <martinh@openbsd.org>2010-07-13 12:54:51 +0000
commitf12396bd54a8fefffac811cdb33f6dbe7b93ad60 (patch)
tree67d859c9f963e22a26a0bc3a913acb3f0bb83659 /usr.sbin/ldapd/attributes.c
parentWhen cleaning /tmp at boot, run the slower find unconditionally. (diff)
downloadwireguard-openbsd-f12396bd54a8fefffac811cdb33f6dbe7b93ad60.tar.xz
wireguard-openbsd-f12396bd54a8fefffac811cdb33f6dbe7b93ad60.zip
Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are freed. Fix this by unlinking the values from the request.
Diffstat (limited to 'usr.sbin/ldapd/attributes.c')
-rw-r--r--usr.sbin/ldapd/attributes.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ldapd/attributes.c b/usr.sbin/ldapd/attributes.c
index c6c724ea200..966969d5cbb 100644
--- a/usr.sbin/ldapd/attributes.c
+++ b/usr.sbin/ldapd/attributes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: attributes.c,v 1.1 2010/05/31 17:36:31 martinh Exp $ */
+/* $OpenBSD: attributes.c,v 1.2 2010/07/13 12:54:51 martinh Exp $ */
/*
* Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se>
@@ -132,6 +132,9 @@ ldap_set_values(struct ber_element *elm, struct ber_element *vals)
old_vals->be_sub = NULL;
ber_link_elements(old_vals, vals->be_sub);
+ vals->be_sub = NULL;
+ ber_free_elements(vals);
+
return 0;
}
@@ -157,6 +160,9 @@ ldap_merge_values(struct ber_element *elm, struct ber_element *vals)
ber_link_elements(last, vals->be_sub);
+ vals->be_sub = NULL;
+ ber_free_elements(vals);
+
return 0;
}