apps/ca.c:2852: error: NULL_DEREFERENCE
  pointer `revtm` last assigned on line 2850 could be null and is dereferenced at line 2852, column 6.
Showing all 41 steps of the trace


apps/ca.c:2788:1: start of procedure make_revocation_str()
2786.    */
2787.   
2788. > char *make_revocation_str(int rev_type, char *rev_arg)
2789.   	{
2790.   	char *reason = NULL, *other = NULL, *str;

apps/ca.c:2790:2: 
2788.   char *make_revocation_str(int rev_type, char *rev_arg)
2789.   	{
2790. > 	char *reason = NULL, *other = NULL, *str;
2791.   	ASN1_OBJECT *otmp;
2792.   	ASN1_UTCTIME *revtm = NULL;

apps/ca.c:2792:2: 
2790.   	char *reason = NULL, *other = NULL, *str;
2791.   	ASN1_OBJECT *otmp;
2792. > 	ASN1_UTCTIME *revtm = NULL;
2793.   	int i;
2794.   	switch (rev_type)

apps/ca.c:2794:2: 
2792.   	ASN1_UTCTIME *revtm = NULL;
2793.   	int i;
2794. > 	switch (rev_type)
2795.   		{
2796.   	case REV_NONE:

apps/ca.c:2796:2: Switch condition is false. Skipping switch case
2794.   	switch (rev_type)
2795.   		{
2796.   	case REV_NONE:
         ^
2797.   		break;
2798.   

apps/ca.c:2799:2: Switch condition is false. Skipping switch case
2797.   		break;
2798.   
2799.   	case REV_CRL_REASON:
         ^
2800.   		for (i = 0; i < 8; i++)
2801.   			{

apps/ca.c:2815:2: Switch condition is false. Skipping switch case
2813.   		break;
2814.   
2815.   	case REV_HOLD:
         ^
2816.   		/* Argument is an OID */
2817.   

apps/ca.c:2831:2: Switch condition is true. Entering switch case
2829.   		break;
2830.   		
2831.   	case REV_KEY_COMPROMISE:
         ^
2832.   	case REV_CA_COMPROMISE:
2833.   

apps/ca.c:2835:8: 
2833.   
2834.   		/* Argument is the key compromise time  */
2835. > 		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
2836.   			{	
2837.   			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);

crypto/asn1/a_gentm.c:171:1: start of procedure ASN1_GENERALIZEDTIME_set_string()
  169.   	}
  170.   
  171. > int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
  172.   	{
  173.   	ASN1_GENERALIZEDTIME t;

crypto/asn1/a_gentm.c:175:2: 
  173.   	ASN1_GENERALIZEDTIME t;
  174.   
  175. > 	t.type=V_ASN1_GENERALIZEDTIME;
  176.   	t.length=strlen(str);
  177.   	t.data=(unsigned char *)str;

crypto/asn1/a_gentm.c:176:2: 
  174.   
  175.   	t.type=V_ASN1_GENERALIZEDTIME;
  176. > 	t.length=strlen(str);
  177.   	t.data=(unsigned char *)str;
  178.   	if (ASN1_GENERALIZEDTIME_check(&t))

crypto/asn1/a_gentm.c:177:2: 
  175.   	t.type=V_ASN1_GENERALIZEDTIME;
  176.   	t.length=strlen(str);
  177. > 	t.data=(unsigned char *)str;
  178.   	if (ASN1_GENERALIZEDTIME_check(&t))
  179.   		{

crypto/asn1/a_gentm.c:178:6: Taking true branch
  176.   	t.length=strlen(str);
  177.   	t.data=(unsigned char *)str;
  178.   	if (ASN1_GENERALIZEDTIME_check(&t))
              ^
  179.   		{
  180.   		if (s != NULL)

crypto/asn1/a_gentm.c:180:7: Taking false branch
  178.   	if (ASN1_GENERALIZEDTIME_check(&t))
  179.   		{
  180.   		if (s != NULL)
               ^
  181.   			{
  182.   			ASN1_STRING_set((ASN1_STRING *)s,

crypto/asn1/a_gentm.c:186:3: 
  184.   			s->type=V_ASN1_GENERALIZEDTIME;
  185.   			}
  186. > 		return(1);
  187.   		}
  188.   	else

crypto/asn1/a_gentm.c:190:2: return from a call to ASN1_GENERALIZEDTIME_set_string
  188.   	else
  189.   		return(0);
  190.   	}
          ^
  191.   
  192.   ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,

apps/ca.c:2835:8: Taking false branch
2833.   
2834.   		/* Argument is the key compromise time  */
2835.   		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
               ^
2836.   			{	
2837.   			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);

apps/ca.c:2840:3: 
2838.   			return NULL;
2839.   			}
2840. > 		other = rev_arg;
2841.   		if (rev_type == REV_KEY_COMPROMISE)
2842.   			reason = "keyTime";

apps/ca.c:2841:7: Taking false branch
2839.   			}
2840.   		other = rev_arg;
2841.   		if (rev_type == REV_KEY_COMPROMISE)
              ^
2842.   			reason = "keyTime";
2843.   		else 

apps/ca.c:2844:4: 
2842.   			reason = "keyTime";
2843.   		else 
2844. > 			reason = "CAkeyTime";
2845.   
2846.   		break;

apps/ca.c:2850:2: 
2848.   		}
2849.   
2850. > 	revtm = X509_gmtime_adj(NULL, 0);
2851.   
2852.   	i = revtm->length + 1;

crypto/x509/x509_vfy.c:825:1: start of procedure X509_gmtime_adj()
  823.   	}
  824.   
  825. > ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
  826.   {
  827.   	return X509_time_adj(s, adj, NULL);

crypto/x509/x509_vfy.c:827:2: 
  825.   ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
  826.   {
  827. > 	return X509_time_adj(s, adj, NULL);
  828.   }
  829.   

crypto/x509/x509_vfy.c:830:1: start of procedure X509_time_adj()
    828.   }
    829.   
    830. > ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)
    831.   	{
    832.   	time_t t;

crypto/x509/x509_vfy.c:833:2: 
    831.   	{
    832.   	time_t t;
    833. > 	int type = -1;
    834.   
    835.   	if (in_tm) t = *in_tm;

crypto/x509/x509_vfy.c:835:6: Taking false branch
    833.   	int type = -1;
    834.   
    835.   	if (in_tm) t = *in_tm;
                ^
    836.   	else time(&t);
    837.   

crypto/x509/x509_vfy.c:836:7: 
    834.   
    835.   	if (in_tm) t = *in_tm;
    836. > 	else time(&t);
    837.   
    838.   	t+=adj;

crypto/x509/x509_vfy.c:838:2: 
    836.   	else time(&t);
    837.   
    838. > 	t+=adj;
    839.   	if (s) type = s->type;
    840.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);

crypto/x509/x509_vfy.c:839:6: Taking false branch
    837.   
    838.   	t+=adj;
    839.   	if (s) type = s->type;
                ^
    840.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    841.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);

crypto/x509/x509_vfy.c:840:6: Taking false branch
    838.   	t+=adj;
    839.   	if (s) type = s->type;
    840.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
                ^
    841.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    842.   	return ASN1_TIME_set(s, t);

crypto/x509/x509_vfy.c:841:6: Taking false branch
    839.   	if (s) type = s->type;
    840.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    841.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
                ^
    842.   	return ASN1_TIME_set(s, t);
    843.   	}

crypto/x509/x509_vfy.c:842:2: 
    840.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    841.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    842. > 	return ASN1_TIME_set(s, t);
    843.   	}
    844.   

crypto/asn1/a_time.c:101:1: start of procedure ASN1_TIME_set()
      99.   
      100.   
      101. > ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
      102.   	{
      103.   	struct tm *ts;

crypto/asn1/a_time.c:106:2: Skipping OPENSSL_gmtime(): empty list of specs
      104.   	struct tm data;
      105.   
      106.   	ts=OPENSSL_gmtime(&t,&data);
              ^
      107.   	if (ts == NULL)
      108.   		return NULL;

crypto/asn1/a_time.c:107:6: Taking true branch
      105.   
      106.   	ts=OPENSSL_gmtime(&t,&data);
      107.   	if (ts == NULL)
                  ^
      108.   		return NULL;
      109.   	if((ts->tm_year >= 50) && (ts->tm_year < 150))

crypto/asn1/a_time.c:108:3: 
      106.   	ts=OPENSSL_gmtime(&t,&data);
      107.   	if (ts == NULL)
      108. > 		return NULL;
      109.   	if((ts->tm_year >= 50) && (ts->tm_year < 150))
      110.   					return ASN1_UTCTIME_set(s, t);

crypto/asn1/a_time.c:112:2: return from a call to ASN1_TIME_set
      110.   					return ASN1_UTCTIME_set(s, t);
      111.   	return ASN1_GENERALIZEDTIME_set(s,t);
      112.   	}
              ^
      113.   
      114.   int ASN1_TIME_check(ASN1_TIME *t)

crypto/x509/x509_vfy.c:843:2: return from a call to X509_time_adj
    841.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    842.   	return ASN1_TIME_set(s, t);
    843.   	}
            ^
    844.   
    845.   int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)

crypto/x509/x509_vfy.c:828:1: return from a call to X509_gmtime_adj
  826.   {
  827.   	return X509_time_adj(s, adj, NULL);
  828. > }
  829.   
  830.   ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)

apps/ca.c:2852:2: 
2850.   	revtm = X509_gmtime_adj(NULL, 0);
2851.   
2852. > 	i = revtm->length + 1;
2853.   
2854.   	if (reason) i += strlen(reason) + 1;

char *make_revocation_str(int rev_type, char *rev_arg)
	{
	char *reason = NULL, *other = NULL, *str;
	ASN1_OBJECT *otmp;
	ASN1_UTCTIME *revtm = NULL;
	int i;
	switch (rev_type)
		{
	case REV_NONE:
		break;
	case REV_CRL_REASON:
		for (i = 0; i < 8; i++)
			{
			if (!strcasecmp(rev_arg, crl_reasons[i]))
				{
				reason = crl_reasons[i];
				break;
				}
			}
		if (reason == NULL)
			{
			BIO_printf(bio_err, "Unknown CRL reason %s\n", rev_arg);
			return NULL;
			}
		break;
	case REV_HOLD:
		otmp = OBJ_txt2obj(rev_arg, 0);
		ASN1_OBJECT_free(otmp);
		if (otmp == NULL)
			{
			BIO_printf(bio_err, "Invalid object identifier %s\n", rev_arg);
			return NULL;
			}
		reason = "holdInstruction";
		other = rev_arg;
		break;
	case REV_KEY_COMPROMISE:
	case REV_CA_COMPROMISE:
		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
			{
			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);
			return NULL;
			}
		other = rev_arg;
		if (rev_type == REV_KEY_COMPROMISE)
			reason = "keyTime";
		else
			reason = "CAkeyTime";
		break;
		}
	revtm = X509_gmtime_adj(NULL, 0);
	i = revtm->length + 1;
	if (reason) i += strlen(reason) + 1;
	if (other) i += strlen(other) + 1;
	str = OPENSSL_malloc(i);
	if (!str) return NULL;
	strcpy(str, (char *)revtm->data);
	if (reason)
		{
		strcat(str, ",");
		strcat(str, reason);
		}
	if (other)
		{
		strcat(str, ",");
		strcat(str, other);
		}
	ASN1_UTCTIME_free(revtm);
	return str;
	}
['char *make_revocation_str(int rev_type, char *rev_arg)\n\t{\n\tchar *reason = NULL, *other = NULL, *str;\n\tASN1_OBJECT *otmp;\n\tASN1_UTCTIME *revtm = NULL;\n\tint i;\n\tswitch (rev_type)\n\t\t{\n\tcase REV_NONE:\n\t\tbreak;\n\tcase REV_CRL_REASON:\n\t\tfor (i = 0; i < 8; i++)\n\t\t\t{\n\t\t\tif (!strcasecmp(rev_arg, crl_reasons[i]))\n\t\t\t\t{\n\t\t\t\treason = crl_reasons[i];\n\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tif (reason == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Unknown CRL reason %s\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tbreak;\n\tcase REV_HOLD:\n\t\totmp = OBJ_txt2obj(rev_arg, 0);\n\t\tASN1_OBJECT_free(otmp);\n\t\tif (otmp == NULL)\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Invalid object identifier %s\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\treason = "holdInstruction";\n\t\tother = rev_arg;\n\t\tbreak;\n\tcase REV_KEY_COMPROMISE:\n\tcase REV_CA_COMPROMISE:\n\t\tif (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))\n\t\t\t{\n\t\t\tBIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\\n", rev_arg);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tother = rev_arg;\n\t\tif (rev_type == REV_KEY_COMPROMISE)\n\t\t\treason = "keyTime";\n\t\telse\n\t\t\treason = "CAkeyTime";\n\t\tbreak;\n\t\t}\n\trevtm = X509_gmtime_adj(NULL, 0);\n\ti = revtm->length + 1;\n\tif (reason) i += strlen(reason) + 1;\n\tif (other) i += strlen(other) + 1;\n\tstr = OPENSSL_malloc(i);\n\tif (!str) return NULL;\n\tstrcpy(str, (char *)revtm->data);\n\tif (reason)\n\t\t{\n\t\tstrcat(str, ",");\n\t\tstrcat(str, reason);\n\t\t}\n\tif (other)\n\t\t{\n\t\tstrcat(str, ",");\n\t\tstrcat(str, other);\n\t\t}\n\tASN1_UTCTIME_free(revtm);\n\treturn str;\n\t}', 'int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)\n\t{\n\tASN1_GENERALIZEDTIME t;\n\tt.type=V_ASN1_GENERALIZEDTIME;\n\tt.length=strlen(str);\n\tt.data=(unsigned char *)str;\n\tif (ASN1_GENERALIZEDTIME_check(&t))\n\t\t{\n\t\tif (s != NULL)\n\t\t\t{\n\t\t\tASN1_STRING_set((ASN1_STRING *)s,\n\t\t\t\t(unsigned char *)str,t.length);\n\t\t\ts->type=V_ASN1_GENERALIZEDTIME;\n\t\t\t}\n\t\treturn(1);\n\t\t}\n\telse\n\t\treturn(0);\n\t}', 'ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)\n{\n\treturn X509_time_adj(s, adj, NULL);\n}', 'ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)\n\t{\n\ttime_t t;\n\tint type = -1;\n\tif (in_tm) t = *in_tm;\n\telse time(&t);\n\tt+=adj;\n\tif (s) type = s->type;\n\tif (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);\n\tif (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);\n\treturn ASN1_TIME_set(s, t);\n\t}', 'ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)\n\t{\n\tstruct tm *ts;\n\tstruct tm data;\n\tts=OPENSSL_gmtime(&t,&data);\n\tif (ts == NULL)\n\t\treturn NULL;\n\tif((ts->tm_year >= 50) && (ts->tm_year < 150))\n\t\t\t\t\treturn ASN1_UTCTIME_set(s, t);\n\treturn ASN1_GENERALIZEDTIME_set(s,t);\n\t}']