svn commit: r297903 - head/usr.sbin/ypldap
Marcelo Araujo
araujo at FreeBSD.org
Wed Apr 13 01:54:35 UTC 2016
Author: araujo
Date: Wed Apr 13 01:54:33 2016
New Revision: 297903
URL: https://svnweb.freebsd.org/changeset/base/297903
Log:
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.
Obtained from: OpenBSD r1.11
Modified:
head/usr.sbin/ypldap/ber.c
Modified: head/usr.sbin/ypldap/ber.c
==============================================================================
--- head/usr.sbin/ypldap/ber.c Wed Apr 13 01:47:04 2016 (r297902)
+++ head/usr.sbin/ypldap/ber.c Wed Apr 13 01:54:33 2016 (r297903)
@@ -1083,6 +1083,15 @@ ber_read_element(struct ber *ber, struct
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;
More information about the svn-src-head
mailing list