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


apps/ca.c:2879:1: start of procedure make_revocation_str()
2877.    */
2878.   
2879. > char *make_revocation_str(int rev_type, char *rev_arg)
2880.   	{
2881.   	char *reason = NULL, *other = NULL, *str;

apps/ca.c:2881:2: 
2879.   char *make_revocation_str(int rev_type, char *rev_arg)
2880.   	{
2881. > 	char *reason = NULL, *other = NULL, *str;
2882.   	ASN1_OBJECT *otmp;
2883.   	ASN1_UTCTIME *revtm = NULL;

apps/ca.c:2883:2: 
2881.   	char *reason = NULL, *other = NULL, *str;
2882.   	ASN1_OBJECT *otmp;
2883. > 	ASN1_UTCTIME *revtm = NULL;
2884.   	int i;
2885.   	switch (rev_type)

apps/ca.c:2885:2: 
2883.   	ASN1_UTCTIME *revtm = NULL;
2884.   	int i;
2885. > 	switch (rev_type)
2886.   		{
2887.   	case REV_NONE:

apps/ca.c:2887:2: Switch condition is false. Skipping switch case
2885.   	switch (rev_type)
2886.   		{
2887.   	case REV_NONE:
         ^
2888.   		break;
2889.   

apps/ca.c:2890:2: Switch condition is false. Skipping switch case
2888.   		break;
2889.   
2890.   	case REV_CRL_REASON:
         ^
2891.   		for (i = 0; i < 8; i++)
2892.   			{

apps/ca.c:2906:2: Switch condition is false. Skipping switch case
2904.   		break;
2905.   
2906.   	case REV_HOLD:
         ^
2907.   		/* Argument is an OID */
2908.   

apps/ca.c:2922:2: Switch condition is true. Entering switch case
2920.   		break;
2921.   		
2922.   	case REV_KEY_COMPROMISE:
         ^
2923.   	case REV_CA_COMPROMISE:
2924.   

apps/ca.c:2926:8: 
2924.   
2925.   		/* Argument is the key compromise time  */
2926. > 		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
2927.   			{	
2928.   			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);

crypto/asn1/a_gentm.c:184:1: start of procedure ASN1_GENERALIZEDTIME_set_string()
  182.   	}
  183.   
  184. > int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
  185.   	{
  186.   	ASN1_GENERALIZEDTIME t;

crypto/asn1/a_gentm.c:188:2: 
  186.   	ASN1_GENERALIZEDTIME t;
  187.   
  188. > 	t.type=V_ASN1_GENERALIZEDTIME;
  189.   	t.length=strlen(str);
  190.   	t.data=(unsigned char *)str;

crypto/asn1/a_gentm.c:189:2: 
  187.   
  188.   	t.type=V_ASN1_GENERALIZEDTIME;
  189. > 	t.length=strlen(str);
  190.   	t.data=(unsigned char *)str;
  191.   	if (ASN1_GENERALIZEDTIME_check(&t))

crypto/asn1/a_gentm.c:190:2: 
  188.   	t.type=V_ASN1_GENERALIZEDTIME;
  189.   	t.length=strlen(str);
  190. > 	t.data=(unsigned char *)str;
  191.   	if (ASN1_GENERALIZEDTIME_check(&t))
  192.   		{

crypto/asn1/a_gentm.c:191:6: Taking true branch
  189.   	t.length=strlen(str);
  190.   	t.data=(unsigned char *)str;
  191.   	if (ASN1_GENERALIZEDTIME_check(&t))
              ^
  192.   		{
  193.   		if (s != NULL)

crypto/asn1/a_gentm.c:193:7: Taking false branch
  191.   	if (ASN1_GENERALIZEDTIME_check(&t))
  192.   		{
  193.   		if (s != NULL)
               ^
  194.   			{
  195.   			ASN1_STRING_set((ASN1_STRING *)s,

crypto/asn1/a_gentm.c:199:3: 
  197.   			s->type=V_ASN1_GENERALIZEDTIME;
  198.   			}
  199. > 		return(1);
  200.   		}
  201.   	else

crypto/asn1/a_gentm.c:203:2: return from a call to ASN1_GENERALIZEDTIME_set_string
  201.   	else
  202.   		return(0);
  203.   	}
          ^
  204.   
  205.   ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,

apps/ca.c:2926:8: Taking false branch
2924.   
2925.   		/* Argument is the key compromise time  */
2926.   		if (!ASN1_GENERALIZEDTIME_set_string(NULL, rev_arg))
               ^
2927.   			{	
2928.   			BIO_printf(bio_err, "Invalid time format %s. Need YYYYMMDDHHMMSSZ\n", rev_arg);

apps/ca.c:2931:3: 
2929.   			return NULL;
2930.   			}
2931. > 		other = rev_arg;
2932.   		if (rev_type == REV_KEY_COMPROMISE)
2933.   			reason = "keyTime";

apps/ca.c:2932:7: Taking false branch
2930.   			}
2931.   		other = rev_arg;
2932.   		if (rev_type == REV_KEY_COMPROMISE)
              ^
2933.   			reason = "keyTime";
2934.   		else 

apps/ca.c:2935:4: 
2933.   			reason = "keyTime";
2934.   		else 
2935. > 			reason = "CAkeyTime";
2936.   
2937.   		break;

apps/ca.c:2941:2: 
2939.   		}
2940.   
2941. > 	revtm = X509_gmtime_adj(NULL, 0);
2942.   
2943.   	i = revtm->length + 1;

crypto/x509/x509_vfy.c:832:1: start of procedure X509_gmtime_adj()
  830.   	}
  831.   
  832. > ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
  833.   {
  834.   	return X509_time_adj(s, adj, NULL);

crypto/x509/x509_vfy.c:834:2: 
  832.   ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj)
  833.   {
  834. > 	return X509_time_adj(s, adj, NULL);
  835.   }
  836.   

crypto/x509/x509_vfy.c:837:1: start of procedure X509_time_adj()
    835.   }
    836.   
    837. > ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)
    838.   	{
    839.   	time_t t;

crypto/x509/x509_vfy.c:840:2: 
    838.   	{
    839.   	time_t t;
    840. > 	int type = -1;
    841.   
    842.   	if (in_tm) t = *in_tm;

crypto/x509/x509_vfy.c:842:6: Taking false branch
    840.   	int type = -1;
    841.   
    842.   	if (in_tm) t = *in_tm;
                ^
    843.   	else time(&t);
    844.   

crypto/x509/x509_vfy.c:843:7: 
    841.   
    842.   	if (in_tm) t = *in_tm;
    843. > 	else time(&t);
    844.   
    845.   	t+=adj;

crypto/x509/x509_vfy.c:845:2: 
    843.   	else time(&t);
    844.   
    845. > 	t+=adj;
    846.   	if (s) type = s->type;
    847.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);

crypto/x509/x509_vfy.c:846:6: Taking false branch
    844.   
    845.   	t+=adj;
    846.   	if (s) type = s->type;
                ^
    847.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    848.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);

crypto/x509/x509_vfy.c:847:6: Taking false branch
    845.   	t+=adj;
    846.   	if (s) type = s->type;
    847.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
                ^
    848.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    849.   	return ASN1_TIME_set(s, t);

crypto/x509/x509_vfy.c:848:6: Taking false branch
    846.   	if (s) type = s->type;
    847.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    848.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
                ^
    849.   	return ASN1_TIME_set(s, t);
    850.   	}

crypto/x509/x509_vfy.c:849:2: 
    847.   	if (type == V_ASN1_UTCTIME) return ASN1_UTCTIME_set(s,t);
    848.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    849. > 	return ASN1_TIME_set(s, t);
    850.   	}
    851.   

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:850:2: return from a call to X509_time_adj
    848.   	if (type == V_ASN1_GENERALIZEDTIME) return ASN1_GENERALIZEDTIME_set(s, t);
    849.   	return ASN1_TIME_set(s, t);
    850.   	}
            ^
    851.   
    852.   int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain)

crypto/x509/x509_vfy.c:835:1: return from a call to X509_gmtime_adj
  833.   {
  834.   	return X509_time_adj(s, adj, NULL);
  835. > }
  836.   
  837.   ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm)

apps/ca.c:2943:2: 
2941.   	revtm = X509_gmtime_adj(NULL, 0);
2942.   
2943. > 	i = revtm->length + 1;
2944.   
2945.   	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}']