fix some unpatched CVEs in OpensslLib

This commit is contained in:
the-Chain-Warden-thresh 2023-11-10 00:47:40 +08:00 committed by GitHub
parent 652c25fa69
commit 7b65b0b7cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -137,7 +137,7 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
*outl=0;
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;

View File

@ -343,7 +343,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
OPENSSL_assert(bl <= (int)sizeof(ctx->buf));
if (i != 0)
{
if (i+inl < bl)
if (bl - i > inl)
{
memcpy(&(ctx->buf[i]),in,inl);
ctx->buf_len+=inl;

View File

@ -92,7 +92,7 @@ int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len)
i=c->num;
if (i != 0)
{
if (i+len < MDC2_BLOCK)
if (len < MDC2_BLOCK - i)
{
/* partial block */
memcpy(&(c->data[i]),in,len);

View File

@ -90,9 +90,8 @@ int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj)
{
char obj_txt[128];
int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
BIO_write(bio, obj_txt, len);
BIO_write(bio, "\n", 1);
OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0);
BIO_printf(bio, "%s\n", obj_txt);
return 1;
}