Fix more error codes.
[openssl.git] / crypto / x509v3 / v3_info.c
index 7f17f32..ab4f0ea 100644 (file)
@@ -105,7 +105,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method
                                                STACK_OF(CONF_VALUE) *ret)
 {
        ACCESS_DESCRIPTION *desc;
-       int i;
+       int i,nlen;
        char objtmp[80], *ntmp;
        CONF_VALUE *vtmp;
        for(i = 0; i < sk_ACCESS_DESCRIPTION_num(ainfo); i++) {
@@ -113,16 +113,17 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method
                ret = i2v_GENERAL_NAME(method, desc->location, ret);
                if(!ret) break;
                vtmp = sk_CONF_VALUE_value(ret, i);
-               i2t_ASN1_OBJECT(objtmp, 80, desc->method);
-               ntmp = OPENSSL_malloc(strlen(objtmp) + strlen(vtmp->name) + 5);
+               i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method);
+               nlen = strlen(objtmp) + strlen(vtmp->name) + 5;
+               ntmp = OPENSSL_malloc(nlen);
                if(!ntmp) {
                        X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS,
                                        ERR_R_MALLOC_FAILURE);
                        return NULL;
                }
-               strcpy(ntmp, objtmp);
-               strcat(ntmp, " - ");
-               strcat(ntmp, vtmp->name);
+               BUF_strlcpy(ntmp, objtmp, nlen);
+               BUF_strlcat(ntmp, " - ", nlen);
+               BUF_strlcat(ntmp, vtmp->name, nlen);
                OPENSSL_free(vtmp->name);
                vtmp->name = ntmp;
                
@@ -140,35 +141,35 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *metho
        int i, objlen;
        char *objtmp, *ptmp;
        if(!(ainfo = sk_ACCESS_DESCRIPTION_new_null())) {
-               X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,ERR_R_MALLOC_FAILURE);
+               X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE);
                return NULL;
        }
        for(i = 0; i < sk_CONF_VALUE_num(nval); i++) {
                cnf = sk_CONF_VALUE_value(nval, i);
                if(!(acc = ACCESS_DESCRIPTION_new())
                        || !sk_ACCESS_DESCRIPTION_push(ainfo, acc)) {
-                       X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,ERR_R_MALLOC_FAILURE);
+                       X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE);
                        goto err;
                }
                ptmp = strchr(cnf->name, ';');
                if(!ptmp) {
-                       X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,X509V3_R_INVALID_SYNTAX);
+                       X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_INVALID_SYNTAX);
                        goto err;
                }
                objlen = ptmp - cnf->name;
                ctmp.name = ptmp + 1;
                ctmp.value = cnf->value;
-               if(!(acc->location = v2i_GENERAL_NAME(method, ctx, &ctmp)))
+               if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0))
                                                                 goto err; 
                if(!(objtmp = OPENSSL_malloc(objlen + 1))) {
-                       X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,ERR_R_MALLOC_FAILURE);
+                       X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE);
                        goto err;
                }
                strncpy(objtmp, cnf->name, objlen);
                objtmp[objlen] = 0;
                acc->method = OBJ_txt2obj(objtmp, 0);
                if(!acc->method) {
-                       X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,X509V3_R_BAD_OBJECT);
+                       X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT);
                        ERR_add_error_data(2, "value=", objtmp);
                        OPENSSL_free(objtmp);
                        goto err;