]> git.sur5r.net Git - openldap/commitdiff
Fix previous commit, need to detect very short packets.
authorHoward Chu <hyc@openldap.org>
Wed, 13 Feb 2002 11:29:05 +0000 (11:29 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 13 Feb 2002 11:29:05 +0000 (11:29 +0000)
libraries/liblber/io.c

index 4a687de4830faf0392f5149b7f0fd70acd4a1299..3f2b30ce031ea824579a64f34758f6988f08e7df 100644 (file)
@@ -519,7 +519,10 @@ ber_get_next(
                }
                /* Are there leftover data bytes inside ber->ber_len? */
                if (ber->ber_ptr < (char *)&ber->ber_usertag) {
-                       i = (char *)&ber->ber_usertag - ber->ber_ptr;
+                       if (ber->ber_rwptr < (char *)&ber->ber_usertag)
+                               i = ber->ber_rwptr - ber->ber_ptr;
+                       else
+                               i = (char *)&ber->ber_usertag - ber->ber_ptr;
                        AC_MEMCPY(buf, ber->ber_ptr, i);
                        ber->ber_ptr += i;
                } else {