]> git.sur5r.net Git - openldap/commitdiff
ITS#5580 fix length decoding, verified with PROTOS
authorHoward Chu <hyc@openldap.org>
Fri, 27 Jun 2008 02:36:41 +0000 (02:36 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 27 Jun 2008 02:36:41 +0000 (02:36 +0000)
libraries/liblber/io.c

index a85f081aa49aba5627a2cf53452c911da6b48959..bceb742b4885f95d256eafceddeec7da0ad11abf 100644 (file)
@@ -584,13 +584,11 @@ ber_get_next(
                                return LBER_DEFAULT;
                        }
                        /* Not enough bytes? */
-                       if (ber->ber_rwptr - (char *)p < llen) {
-#if defined( EWOULDBLOCK )
-                               sock_errset(EWOULDBLOCK);
-#elif defined( EAGAIN )
-                               sock_errset(EAGAIN);
-#endif                 
-                               return LBER_DEFAULT;
+                       i = ber->ber_rwptr - (char *)p;
+                       if (i < llen) {
+                               sblen=ber_int_sb_read( sb, ber->ber_rwptr, i );
+                               if (sblen<i) return LBER_DEFAULT;
+                               ber->ber_rwptr += sblen;
                        }
                        for (i=0; i<llen; i++) {
                                tlen <<=8;