diff --git a/crypto/evp/encode.c b/crypto/evp/encode.c index c6abc4ae8..a5d0c653c 100644 --- a/crypto/evp/encode.c +++ b/crypto/evp/encode.c @@ -157,7 +157,7 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, if (inl <= 0) return; OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); - if ((ctx->num + inl) < ctx->length) { + if (ctx->length - ctx->num > inl) { memcpy(&(ctx->enc_data[ctx->num]), in, inl); ctx->num += inl; return;