Date: Wed, 13 Apr 2016 01:54:34 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297903 - head/usr.sbin/ypldap Message-ID: <201604130154.u3D1sYMw038227@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604130154.u3D1sYMw038227>