aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ypldap
diff options
context:
space:
mode:
authorMarcelo Araujo <araujo@FreeBSD.org>2016-04-13 01:54:33 +0000
committerMarcelo Araujo <araujo@FreeBSD.org>2016-04-13 01:54:33 +0000
commit0e3562425ec6c9c6f456ea29a6f629c316299be7 (patch)
treeb233959f5e3d2229fef91c5e5089fc2fd56708be /usr.sbin/ypldap
parentd13c461400e89224ca649953588ae90d6f55dd36 (diff)
Notes
Diffstat (limited to 'usr.sbin/ypldap')
-rw-r--r--usr.sbin/ypldap/ber.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/ypldap/ber.c b/usr.sbin/ypldap/ber.c
index 540df69ae760..f73ecef86641 100644
--- a/usr.sbin/ypldap/ber.c
+++ b/usr.sbin/ypldap/ber.c
@@ -1083,6 +1083,15 @@ 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;