Commit 9e421962 authored by Andy Polyakov's avatar Andy Polyakov Committed by Matt Caswell
Browse files

evp/bio_enc.c: stop using pointer arithmetic for error detection.



Thanks to David Benjamin for reporting this.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent 44cb4f5b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -148,9 +148,12 @@ static int enc_read(BIO *b, char *out, int outl)

        if (ctx->read_start == ctx->read_end) { /* time to read more data */
            ctx->read_end = ctx->read_start = &(ctx->buf[BUF_OFFSET]);
            ctx->read_end += BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
        }
            i = BIO_read(next, ctx->read_start, ENC_BLOCK_SIZE);
            if (i > 0)
                ctx->read_end += i;
        } else {
            i = ctx->read_end - ctx->read_start;
        }

        if (i <= 0) {
            /* Should be continue next time we are called? */