diff --git a/crypto/evp/encode.c b/crypto/evp/encode.c index ed85f8933bc01f01cea67d39650cb960a69d6247..6f862fa2dd2c8c158437d225b7683806d7c673ea 100644 --- a/crypto/evp/encode.c +++ b/crypto/evp/encode.c @@ -171,7 +171,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;