crypto/x509/x509_cmp.c:93: error: NULL_DEREFERENCE
  pointer `f` last assigned on line 90 could be null and is dereferenced by call to `strlen()` at line 93, column 52.
Showing all 64 steps of the trace


crypto/x509/x509_cmp.c:81:1: start of procedure X509_issuer_and_serial_hash()
79.   
80.   #ifndef OPENSSL_NO_MD5
81. > unsigned long X509_issuer_and_serial_hash(X509 *a)
82.   {
83.       unsigned long ret = 0;

crypto/x509/x509_cmp.c:83:5: 
81.   unsigned long X509_issuer_and_serial_hash(X509 *a)
82.   {
83. >     unsigned long ret = 0;
84.       EVP_MD_CTX *ctx = EVP_MD_CTX_new();
85.       unsigned char md[16];

crypto/x509/x509_cmp.c:84:5: 
82.   {
83.       unsigned long ret = 0;
84. >     EVP_MD_CTX *ctx = EVP_MD_CTX_new();
85.       unsigned char md[16];
86.       char *f;

crypto/evp/digest.c:152:1: start of procedure EVP_MD_CTX_new()
  150.   }
  151.   
  152. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:154:5: 
  152.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155.   }
  156.   

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:155:1: return from a call to EVP_MD_CTX_new
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155. > }
  156.   
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/x509/x509_cmp.c:88:9: Taking false branch
86.       char *f;
87.   
88.       if (ctx == NULL)
              ^
89.           goto err;
90.       f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);

crypto/x509/x509_cmp.c:90:5: 
88.       if (ctx == NULL)
89.           goto err;
90. >     f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
91.       if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
92.           goto err;

crypto/x509/x509_obj.c:66:1: start of procedure X509_NAME_oneline()
  64.   #include "internal/x509_int.h"
  65.   
  66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
  67.   {
  68.       X509_NAME_ENTRY *ne;

crypto/x509/x509_obj.c:74:5: 
  72.       char *p;
  73.       unsigned char *q;
  74. >     BUF_MEM *b = NULL;
  75.       static const char hex[17] = "0123456789ABCDEF";
  76.       int gs_doit[4];

crypto/x509/x509_obj.c:75:5: 
  73.       unsigned char *q;
  74.       BUF_MEM *b = NULL;
  75. >     static const char hex[17] = "0123456789ABCDEF";
  76.       int gs_doit[4];
  77.       char tmp_buf[80];

crypto/x509/x509_obj.c:82:9: Taking true branch
  80.   #endif
  81.   
  82.       if (buf == NULL) {
                ^
  83.           if ((b = BUF_MEM_new()) == NULL)
  84.               goto err;

crypto/x509/x509_obj.c:83:13: 
  81.   
  82.       if (buf == NULL) {
  83. >         if ((b = BUF_MEM_new()) == NULL)
  84.               goto err;
  85.           if (!BUF_MEM_grow(b, 200))

crypto/buffer/buffer.c:79:1: start of procedure BUF_MEM_new()
    77.   }
    78.   
    79. > BUF_MEM *BUF_MEM_new(void)
    80.   {
    81.       BUF_MEM *ret;

crypto/buffer/buffer.c:83:5: 
    81.       BUF_MEM *ret;
    82.   
    83. >     ret = OPENSSL_zalloc(sizeof(*ret));
    84.       if (ret == NULL) {
    85.           BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
      154.   }
      155.   
      156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158. >     void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
        117.   }
        118.   
        119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        120.   {
        121.       void *ret = NULL;

crypto/mem.c:121:5: 
        119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        120.   {
        121. >     void *ret = NULL;
        122.   
        123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
        121.       void *ret = NULL;
        122.   
        123.       if (num <= 0)
                       ^
        124.           return NULL;
        125.   

crypto/mem.c:126:5: 
        124.           return NULL;
        125.   
        126. >     allow_customize = 0;
        127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
        134.       }
        135.   #else
        136. >     (void)file;
        137.       (void)line;
        138.       ret = malloc(num);

crypto/mem.c:137:5: 
        135.   #else
        136.       (void)file;
        137. >     (void)line;
        138.       ret = malloc(num);
        139.   #endif

crypto/mem.c:138:5: 
        136.       (void)file;
        137.       (void)line;
        138. >     ret = malloc(num);
        139.   #endif
        140.   

crypto/mem.c:153:5: 
        151.   #endif
        152.   
        153. >     return ret;
        154.   }
        155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
        152.   
        153.       return ret;
        154. > }
        155.   
        156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking false branch
      158.       void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)
                     ^
      161.           memset(ret, 0, num);
      162.       return ret;

crypto/mem.c:162:5: 
      160.       if (ret != NULL)
      161.           memset(ret, 0, num);
      162. >     return ret;
      163.   }
      164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
      161.           memset(ret, 0, num);
      162.       return ret;
      163. > }
      164.   
      165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/buffer/buffer.c:84:9: Taking true branch
    82.   
    83.       ret = OPENSSL_zalloc(sizeof(*ret));
    84.       if (ret == NULL) {
                  ^
    85.           BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE);
    86.           return (NULL);

crypto/buffer/buffer.c:85:9: Skipping ERR_put_error(): empty list of specs
    83.       ret = OPENSSL_zalloc(sizeof(*ret));
    84.       if (ret == NULL) {
    85.           BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE);
                  ^
    86.           return (NULL);
    87.       }

crypto/buffer/buffer.c:86:9: 
    84.       if (ret == NULL) {
    85.           BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE);
    86. >         return (NULL);
    87.       }
    88.       return (ret);

crypto/buffer/buffer.c:89:1: return from a call to BUF_MEM_new
    87.       }
    88.       return (ret);
    89. > }
    90.   
    91.   void BUF_MEM_free(BUF_MEM *a)

crypto/x509/x509_obj.c:83:13: Taking true branch
  81.   
  82.       if (buf == NULL) {
  83.           if ((b = BUF_MEM_new()) == NULL)
                    ^
  84.               goto err;
  85.           if (!BUF_MEM_grow(b, 200))

crypto/x509/x509_obj.c:207:2: 
  205.           *p = '\0';
  206.       return (p);
  207. >  err:
  208.       X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
  209.       BUF_MEM_free(b);

crypto/x509/x509_obj.c:208:5: Skipping ERR_put_error(): empty list of specs
  206.       return (p);
  207.    err:
  208.       X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
             ^
  209.       BUF_MEM_free(b);
  210.       return (NULL);

crypto/x509/x509_obj.c:209:5: 
  207.    err:
  208.       X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
  209. >     BUF_MEM_free(b);
  210.       return (NULL);
  211.   }

crypto/buffer/buffer.c:91:1: start of procedure BUF_MEM_free()
    89.   }
    90.   
    91. > void BUF_MEM_free(BUF_MEM *a)
    92.   {
    93.       if (a == NULL)

crypto/buffer/buffer.c:93:9: Taking true branch
    91.   void BUF_MEM_free(BUF_MEM *a)
    92.   {
    93.       if (a == NULL)
                  ^
    94.           return;
    95.   

crypto/buffer/buffer.c:94:9: 
    92.   {
    93.       if (a == NULL)
    94. >         return;
    95.   
    96.       if (a->data != NULL) {

crypto/buffer/buffer.c:104:1: return from a call to BUF_MEM_free
    102.       }
    103.       OPENSSL_free(a);
    104. > }
    105.   
    106.   /* Allocate a block of secure memory; copy over old data if there

crypto/x509/x509_obj.c:210:5: 
  208.       X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
  209.       BUF_MEM_free(b);
  210. >     return (NULL);
  211.   }

crypto/x509/x509_obj.c:211:1: return from a call to X509_NAME_oneline
  209.       BUF_MEM_free(b);
  210.       return (NULL);
  211. > }

crypto/x509/x509_cmp.c:91:10: 
89.           goto err;
90.       f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
91. >     if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
92.           goto err;
93.       if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f)))

crypto/evp/m_md5.c:101:1: start of procedure EVP_md5()
  99.   };
  100.   
  101. > const EVP_MD *EVP_md5(void)
  102.   {
  103.       return (&md5_md);

crypto/evp/m_md5.c:103:5: 
  101.   const EVP_MD *EVP_md5(void)
  102.   {
  103. >     return (&md5_md);
  104.   }
  105.   #endif

crypto/evp/m_md5.c:104:1: return from a call to EVP_md5
  102.   {
  103.       return (&md5_md);
  104. > }
  105.   #endif

crypto/x509/x509_cmp.c:91:10: Taking false branch
89.           goto err;
90.       f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
91.       if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
               ^
92.           goto err;
93.       if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f)))

crypto/x509/x509_cmp.c:93:10: 
91.       if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
92.           goto err;
93. >     if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f)))
94.           goto err;
95.       OPENSSL_free(f);
