crypto/x509v3/v3_prn.c:82: error: NULL_DEREFERENCE
  pointer `extoct` last assigned on line 81 could be null and is dereferenced by call to `ASN1_STRING_data()` at line 82, column 9.
Showing all 13 steps of the trace


crypto/x509v3/v3_prn.c:69:1: start of procedure X509V3_EXT_print()
67.   /* Main routine: print out a general extension */
68.   
69. > int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
70.                        int indent)
71.   {

crypto/x509v3/v3_prn.c:72:5: 
70.                        int indent)
71.   {
72. >     void *ext_str = NULL;
73.       char *value = NULL;
74.       ASN1_OCTET_STRING *extoct;

crypto/x509v3/v3_prn.c:73:5: 
71.   {
72.       void *ext_str = NULL;
73. >     char *value = NULL;
74.       ASN1_OCTET_STRING *extoct;
75.       const unsigned char *p;

crypto/x509v3/v3_prn.c:78:5: 
76.       int extlen;
77.       const X509V3_EXT_METHOD *method;
78. >     STACK_OF(CONF_VALUE) *nval = NULL;
79.       int ok = 1;
80.   

crypto/x509v3/v3_prn.c:79:5: 
77.       const X509V3_EXT_METHOD *method;
78.       STACK_OF(CONF_VALUE) *nval = NULL;
79. >     int ok = 1;
80.   
81.       extoct = X509_EXTENSION_get_data(ext);

crypto/x509v3/v3_prn.c:81:5: 
79.       int ok = 1;
80.   
81. >     extoct = X509_EXTENSION_get_data(ext);
82.       p = ASN1_STRING_data(extoct);
83.       extlen = ASN1_STRING_length(extoct);

crypto/x509/x509_v3.c:220:1: start of procedure X509_EXTENSION_get_data()
  218.   }
  219.   
  220. > ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ex)
  221.   {
  222.       if (ex == NULL)

crypto/x509/x509_v3.c:222:9: Taking true branch
  220.   ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ex)
  221.   {
  222.       if (ex == NULL)
                 ^
  223.           return (NULL);
  224.       return &ex->value;

crypto/x509/x509_v3.c:223:9: 
  221.   {
  222.       if (ex == NULL)
  223. >         return (NULL);
  224.       return &ex->value;
  225.   }

crypto/x509/x509_v3.c:225:1: return from a call to X509_EXTENSION_get_data
  223.           return (NULL);
  224.       return &ex->value;
  225. > }
  226.   
  227.   int X509_EXTENSION_get_critical(const X509_EXTENSION *ex)

crypto/x509v3/v3_prn.c:82:5: 
80.   
81.       extoct = X509_EXTENSION_get_data(ext);
82. >     p = ASN1_STRING_data(extoct);
83.       extlen = ASN1_STRING_length(extoct);
84.   

crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_data()
  360.   }
  361.   
  362. > unsigned char *ASN1_STRING_data(ASN1_STRING *x)
  363.   {
  364.       return x->data;

crypto/asn1/asn1_lib.c:364:5: 
  362.   unsigned char *ASN1_STRING_data(ASN1_STRING *x)
  363.   {
  364. >     return x->data;
  365.   }

int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
                     int indent)
{
    void *ext_str = NULL;
    char *value = NULL;
    ASN1_OCTET_STRING *extoct;
    const unsigned char *p;
    int extlen;
    const X509V3_EXT_METHOD *method;
    STACK_OF(CONF_VALUE) *nval = NULL;
    int ok = 1;
    extoct = X509_EXTENSION_get_data(ext);
    p = ASN1_STRING_data(extoct);
    extlen = ASN1_STRING_length(extoct);
    if ((method = X509V3_EXT_get(ext)) == NULL)
        return unknown_ext_print(out, p, extlen, flag, indent, 0);
    if (method->it)
        ext_str = ASN1_item_d2i(NULL, &p, extlen, ASN1_ITEM_ptr(method->it));
    else
        ext_str = method->d2i(NULL, &p, extlen);
    if (!ext_str)
        return unknown_ext_print(out, p, extlen, flag, indent, 1);
    if (method->i2s) {
        if ((value = method->i2s(method, ext_str)) == NULL) {
            ok = 0;
            goto err;
        }
#ifndef CHARSET_EBCDIC
        BIO_printf(out, "%*s%s", indent, "", value);
#else
        {
            int len;
            char *tmp;
            len = strlen(value) + 1;
            tmp = OPENSSL_malloc(len);
            if (tmp != NULL) {
                ascii2ebcdic(tmp, value, len);
                BIO_printf(out, "%*s%s", indent, "", tmp);
                OPENSSL_free(tmp);
            }
        }
#endif
    } else if (method->i2v) {
        if ((nval = method->i2v(method, ext_str, NULL)) == NULL) {
            ok = 0;
            goto err;
        }
        X509V3_EXT_val_prn(out, nval, indent,
                           method->ext_flags & X509V3_EXT_MULTILINE);
    } else if (method->i2r) {
        if (!method->i2r(method, ext_str, out, indent))
            ok = 0;
    } else
        ok = 0;
 err:
    sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
    OPENSSL_free(value);
    if (method->it)
        ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it));
    else
        method->ext_free(ext_str);
    return ok;
}
['int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,\n                     int indent)\n{\n    void *ext_str = NULL;\n    char *value = NULL;\n    ASN1_OCTET_STRING *extoct;\n    const unsigned char *p;\n    int extlen;\n    const X509V3_EXT_METHOD *method;\n    STACK_OF(CONF_VALUE) *nval = NULL;\n    int ok = 1;\n    extoct = X509_EXTENSION_get_data(ext);\n    p = ASN1_STRING_data(extoct);\n    extlen = ASN1_STRING_length(extoct);\n    if ((method = X509V3_EXT_get(ext)) == NULL)\n        return unknown_ext_print(out, p, extlen, flag, indent, 0);\n    if (method->it)\n        ext_str = ASN1_item_d2i(NULL, &p, extlen, ASN1_ITEM_ptr(method->it));\n    else\n        ext_str = method->d2i(NULL, &p, extlen);\n    if (!ext_str)\n        return unknown_ext_print(out, p, extlen, flag, indent, 1);\n    if (method->i2s) {\n        if ((value = method->i2s(method, ext_str)) == NULL) {\n            ok = 0;\n            goto err;\n        }\n#ifndef CHARSET_EBCDIC\n        BIO_printf(out, "%*s%s", indent, "", value);\n#else\n        {\n            int len;\n            char *tmp;\n            len = strlen(value) + 1;\n            tmp = OPENSSL_malloc(len);\n            if (tmp != NULL) {\n                ascii2ebcdic(tmp, value, len);\n                BIO_printf(out, "%*s%s", indent, "", tmp);\n                OPENSSL_free(tmp);\n            }\n        }\n#endif\n    } else if (method->i2v) {\n        if ((nval = method->i2v(method, ext_str, NULL)) == NULL) {\n            ok = 0;\n            goto err;\n        }\n        X509V3_EXT_val_prn(out, nval, indent,\n                           method->ext_flags & X509V3_EXT_MULTILINE);\n    } else if (method->i2r) {\n        if (!method->i2r(method, ext_str, out, indent))\n            ok = 0;\n    } else\n        ok = 0;\n err:\n    sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);\n    OPENSSL_free(value);\n    if (method->it)\n        ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it));\n    else\n        method->ext_free(ext_str);\n    return ok;\n}', 'ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ex)\n{\n    if (ex == NULL)\n        return (NULL);\n    return &ex->value;\n}', 'unsigned char *ASN1_STRING_data(ASN1_STRING *x)\n{\n    return x->data;\n}']