PR: 1854
[openssl.git] / crypto / asn1 / evp_asn1.c
index 3506005a7146faef41f681abfc70f273fe0cee00..f3d9804860ec31fc09d885f18f3c6e3e47ad00da 100644 (file)
@@ -115,7 +115,11 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
 
        if ((osp=ASN1_STRING_new()) == NULL) return(0);
        /* Grow the 'string' */
-       ASN1_STRING_set(osp,NULL,size);
+       if (!ASN1_STRING_set(osp,NULL,size))
+               {
+               ASN1_STRING_free(osp);
+               return(0);
+               }
 
        M_ASN1_STRING_length_set(osp, size);
        p=M_ASN1_STRING_data(osp);
@@ -137,9 +141,9 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
        int ret= -1,n;
        ASN1_INTEGER *ai=NULL;
        ASN1_OCTET_STRING *os=NULL;
-       unsigned char *p;
+       const unsigned char *p;
        long length;
-       ASN1_CTX c;
+       ASN1_const_CTX c;
 
        if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
                {