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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to