From b1c39eff65fe42a5b1d6759208ea73a5eb2babf8 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 13 Feb 2002 11:29:05 +0000 Subject: [PATCH] Fix previous commit, need to detect very short packets. --- libraries/liblber/io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 { -- 2.39.5