From 3fc96a24eeffc4cf2fc93983ba7be558338a66df Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 19 May 2003 12:14:15 +0000 Subject: [PATCH] More ITS#2490 - fix retries for multi-byte lengths --- libraries/liblber/io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 9428e1f602..65ff26cf1f 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -557,13 +557,14 @@ ber_get_next( /* Now look for the length */ if (*ber->ber_ptr & 0x80) { /* multi-byte */ ber_len_t i; - int llen = *(unsigned char *)ber->ber_ptr++ & 0x7f; + unsigned char *p = (unsigned char *)ber->ber_ptr; + int llen = *p++ & 0x7f; if (llen > (int)sizeof(ber_len_t)) { errno = ERANGE; return LBER_DEFAULT; } /* Not enough bytes? */ - if (ber->ber_rwptr - ber->ber_ptr < llen) { + if (ber->ber_rwptr - (char *)p < llen) { #if defined( EWOULDBLOCK ) errno = EWOULDBLOCK; #elif defined( EAGAIN ) @@ -571,13 +572,12 @@ ber_get_next( #endif return LBER_DEFAULT; } - for (i=0; - iber_ptrber_rwptr; - i++,ber->ber_ptr++) + for (i=0; iber_ptr; + tlen |= *p++; } + ber->ber_ptr = p; } else { tlen = *(unsigned char *)ber->ber_ptr++; } -- 2.39.5