From: Howard Chu Date: Wed, 13 Feb 2002 11:29:05 +0000 (+0000) Subject: Fix previous commit, need to detect very short packets. X-Git-Tag: OPENLDAP_REL_ENG_2_1_BP~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b1c39eff65fe42a5b1d6759208ea73a5eb2babf8;p=openldap Fix previous commit, need to detect very short packets. --- diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 4a687de483..3f2b30ce03 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -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 {