diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2004-12-05 02:03:15 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2004-12-05 02:03:15 +0100 |
commit | a0e7c8eede26b29b09057f48b8e51f46f8811ddd (patch) | |
tree | 2b50575b4e9e608b61cb74246915625bd99b85d8 /crypto/asn1/a_gentm.c | |
parent | Update year. (diff) | |
download | openssl-a0e7c8eede26b29b09057f48b8e51f46f8811ddd.tar.xz openssl-a0e7c8eede26b29b09057f48b8e51f46f8811ddd.zip |
Add lots of checks for memory allocation failure, error codes to indicate
failure and freeing up memory if a failure occurs.
PR:620
Diffstat (limited to 'crypto/asn1/a_gentm.c')
-rw-r--r-- | crypto/asn1/a_gentm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index ea8d7b96c8..def79062a5 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -192,8 +192,9 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) { if (s != NULL) { - ASN1_STRING_set((ASN1_STRING *)s, - (unsigned char *)str,t.length); + if (!ASN1_STRING_set((ASN1_STRING *)s, + (unsigned char *)str,t.length)) + return 0; s->type=V_ASN1_GENERALIZEDTIME; } return(1); @@ -223,7 +224,12 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, if ((p == NULL) || ((size_t)s->length < len)) { p=OPENSSL_malloc(len); - if (p == NULL) return(NULL); + if (p == NULL) + { + ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET, + ERR_R_MALLOC_FAILURE); + return(NULL); + } if (s->data != NULL) OPENSSL_free(s->data); s->data=(unsigned char *)p; |