This patch seems to have introduced some code duplication:
It seems harmless, but still.
I tried to look line by line of the patch but I may have left something.
On 2004-12-05 02:04:45 +0100, Dr. Stephen Henson wrote:
> --- openssl/crypto/asn1/a_bitstr.c 12 Nov 2002 13:21:19 -0000 1.13.2.3
> +++ openssl/crypto/asn1/a_bitstr.c 5 Dec 2004 01:04:33 -0000 1.13.2.4
> @@ -194,7 +194,12 @@
> c=(unsigned char *)OPENSSL_realloc_clean(a->data,
> a->length,
> w+1);
> - if (c == NULL) return(0);
> + if (c == NULL)
> + {
> +
> ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE);
> + return 0;
> + }
> + if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
Duplication
> if (w+1-a->length > 0) memset(c+a->length, 0, w+1-a->length);
> a->data=c;
> a->length=w+1;
> --- openssl/crypto/asn1/a_utctm.c 27 Jan 2004 01:16:09 -0000 1.24.2.3
> +++ openssl/crypto/asn1/a_utctm.c 5 Dec 2004 01:04:33 -0000 1.24.2.4
> @@ -203,7 +204,12 @@
> if ((p == NULL) || ((size_t)s->length < len))
> {
> p=OPENSSL_malloc(len);
> - if (p == NULL) return(NULL);
> + if (p == NULL)
> + {
> + ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
> + return(NULL);
> + }
> + if (s->data != NULL)
Duplication
> if (s->data != NULL)
> OPENSSL_free(s->data);
> s->data=(unsigned char *)p;
> --- openssl/crypto/asn1/x_pubkey.c 30 May 2002 16:50:36 -0000 1.21.2.2
> +++ openssl/crypto/asn1/x_pubkey.c 5 Dec 2004 01:04:33 -0000 1.21.2.3
> @@ -143,7 +166,12 @@
> }
> p=s;
> i2d_PublicKey(pkey,&p);
> - if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;
> + if (!M_ASN1_BIT_STRING_set(pk->public_key,s,i))
> + {
> + X509err(X509_F_X509_PUBKEY_SET,ERR_R_MALLOC_FAILURE);
> + goto err;
> + }
> + /* Set number of unused bits to zero */
Duplication
> /* Set number of unused bits to zero */
> pk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
> pk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]