diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-10-19 09:34:42 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-10-19 09:34:42 +0000 |
commit | 44dca181570611f76dd03d975d4c938eca761a5a (patch) | |
tree | 4c2329b54128b6f26357c0604e10653b5219c006 /usr.sbin/ldapd | |
parent | 3706d6391974771c1711af9a4ffb67f572baaed7 (diff) |
Fix a segmentation fault when adding an attribute to an empty entry.
Diffstat (limited to 'usr.sbin/ldapd')
-rw-r--r-- | usr.sbin/ldapd/attributes.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ldapd/attributes.c b/usr.sbin/ldapd/attributes.c index 966969d5cbb..b89c75f8d43 100644 --- a/usr.sbin/ldapd/attributes.c +++ b/usr.sbin/ldapd/attributes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: attributes.c,v 1.2 2010/07/13 12:54:51 martinh Exp $ */ +/* $OpenBSD: attributes.c,v 1.3 2010/10/19 09:34:41 martinh Exp $ */ /* * Copyright (c) 2009 Martin Hedenfalk <martin@bzero.se> @@ -99,7 +99,9 @@ ldap_add_attribute(struct ber_element *entry, const char *attr, } last = entry->be_sub; - while (last && last->be_next != NULL) + if (last == NULL) + last = entry; + else while (last != NULL && last->be_next != NULL) last = last->be_next; if ((elm = ber_add_sequence(last)) == NULL) |