From owner-svn-src-all@freebsd.org Wed Apr 13 01:54:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E72EB0E2BA; Wed, 13 Apr 2016 01:54:35 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3BBF1026; Wed, 13 Apr 2016 01:54:34 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3D1sYbK038228; Wed, 13 Apr 2016 01:54:34 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3D1sYMw038227; Wed, 13 Apr 2016 01:54:34 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604130154.u3D1sYMw038227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 13 Apr 2016 01:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297903 - head/usr.sbin/ypldap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2016 01:54:35 -0000 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;