diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2016-04-06 13:04:11 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2016-04-06 13:04:11 +0000 |
commit | 9ff2b854429fad07ccf08ca4dafca487ca296d18 (patch) | |
tree | 313b912f135d0915c43353be1d35253315e4e7da /usr.sbin | |
parent | 5e6f35da11934357be45cdf737763250b580b738 (diff) |
Apply revisions 1.4 and 1.5 from ldapd's ber.c to ypldap's copy, so it can
deal with messages that haven't been fully read from the server yet.
Not needed yet, but will be soon.
ok dlg@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ypldap/ber.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/ypldap/ber.c b/usr.sbin/ypldap/ber.c index ca39d10aa71..e61d8e9c1bc 100644 --- a/usr.sbin/ypldap/ber.c +++ b/usr.sbin/ypldap/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.11 2016/03/05 03:31:39 deraadt Exp $ */ +/* $OpenBSD: ber.c,v 1.12 2016/04/06 13:04:10 jmatthew Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net> @@ -1082,6 +1082,13 @@ ber_read_element(struct ber *ber, struct ber_element *elm) DPRINTF("ber read element size %zd\n", len); totlen += r + len; + /* If using an external buffer and the total size of the element + * is larger then the external buffer don't bother to continue. */ + if (ber->fd == -1 && len > ber->br_rend - ber->br_rptr) { + errno = ECANCELED; + return -1; + } + elm->be_type = type; elm->be_len = len; elm->be_class = class; |