diff options
Diffstat (limited to 'crypto')
134 files changed, 3582 insertions, 1047 deletions
diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c index 4af2276a8d..f36c769b18 100644 --- a/crypto/asn1/a_d2i_fp.c +++ b/crypto/asn1/a_d2i_fp.c @@ -148,6 +148,9 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) goto err; } len += i; + if ((size_t)i < want) + continue; + } } /* else data already loaded */ diff --git a/crypto/asn1/a_dup.c b/crypto/asn1/a_dup.c index 23d1d63808..33dc3ff58e 100644 --- a/crypto/asn1/a_dup.c +++ b/crypto/asn1/a_dup.c @@ -75,7 +75,7 @@ void *ASN1_item_dup(const ASN1_ITEM *it, const void *x) } i = ASN1_item_i2d(x, &b, it); - if (b == NULL) { + if (i < 0 || b == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB); return NULL; } diff --git a/crypto/asn1/a_i2d_fp.c b/crypto/asn1/a_i2d_fp.c index e30f1f2a17..ccee6fccb0 100644 --- a/crypto/asn1/a_i2d_fp.c +++ b/crypto/asn1/a_i2d_fp.c @@ -88,7 +88,7 @@ int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, const void *x) int i, j = 0, n, ret = 1; n = ASN1_item_i2d(x, &b, it); - if (b == NULL) { + if (n < 0 || b == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB); return 0; } diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index 73c69eacd2..2279379793 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -198,7 +198,8 @@ int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a) } if (i <= 0) { i = BIO_write(bp, "<INVALID>", 9); - i += BIO_dump(bp, (const char *)a->data, a->length); + if (i > 0) + i += BIO_dump(bp, (const char *)a->data, a->length); return i; } BIO_write(bp, p, i); diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c index 29ea60596e..87365af32d 100644 --- a/crypto/asn1/a_strex.c +++ b/crypto/asn1/a_strex.c @@ -10,6 +10,7 @@ #include <stdio.h> #include <string.h> #include "internal/cryptlib.h" +#include "internal/sizes.h" #include "crypto/asn1.h" #include <openssl/crypto.h> #include <openssl/x509.h> @@ -234,15 +235,14 @@ static int do_buf(unsigned char *buf, int buflen, static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen) { - static const char hexdig[] = "0123456789ABCDEF"; unsigned char *p, *q; char hextmp[2]; + if (arg) { p = buf; q = buf + buflen; while (p != q) { - hextmp[0] = hexdig[*p >> 4]; - hextmp[1] = hexdig[*p & 0xf]; + ossl_to_hex(hextmp, *p); if (!io_ch(arg, hextmp, 2)) return -1; |