crypto/objects/obj_dat.c:493: error: NULL_DEREFERENCE
  pointer `s` last assigned on line 492 could be null and is dereferenced by call to `strncpy()` at line 493, column 3.
Showing all 71 steps of the trace


crypto/objects/obj_dat.c:434:1: start of procedure OBJ_obj2txt()
432.   	}
433.   
434. > int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
435.   {
436.   	int i,idx=0,n=0,len,nid;

crypto/objects/obj_dat.c:436:2: 
434.   int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
435.   {
436. > 	int i,idx=0,n=0,len,nid;
437.   	unsigned long l;
438.   	unsigned char *p;

crypto/objects/obj_dat.c:442:6: Taking false branch
440.   	char tbuf[32];
441.   
442.   	if (buf_len <= 0) return(0);
            ^
443.   
444.   	if ((a == NULL) || (a->data == NULL)) {

crypto/objects/obj_dat.c:444:7: Taking false branch
442.   	if (buf_len <= 0) return(0);
443.   
444.   	if ((a == NULL) || (a->data == NULL)) {
             ^
445.   		buf[0]='\0';
446.   		return(0);

crypto/objects/obj_dat.c:444:22: Taking false branch
442.   	if (buf_len <= 0) return(0);
443.   
444.   	if ((a == NULL) || (a->data == NULL)) {
                            ^
445.   		buf[0]='\0';
446.   		return(0);

crypto/objects/obj_dat.c:449:2: 
447.   	}
448.   
449. > 	nid=OBJ_obj2nid(a);
450.   	if ((nid == NID_undef) || no_name) {
451.   		len=a->length;

crypto/objects/obj_dat.c:367:1: start of procedure OBJ_obj2nid()
  365.   	}
  366.   
  367. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  368.   	{
  369.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:372:6: Taking false branch
  370.   	ADDED_OBJ ad,*adp;
  371.   
  372.   	if (a == NULL)
              ^
  373.   		return(NID_undef);
  374.   	if (a->nid != 0)

crypto/objects/obj_dat.c:374:6: Taking true branch
  372.   	if (a == NULL)
  373.   		return(NID_undef);
  374.   	if (a->nid != 0)
              ^
  375.   		return(a->nid);
  376.   

crypto/objects/obj_dat.c:375:3: 
  373.   		return(NID_undef);
  374.   	if (a->nid != 0)
  375. > 		return(a->nid);
  376.   
  377.   	if (added != NULL)

crypto/objects/obj_dat.c:389:2: return from a call to OBJ_obj2nid
  387.   		return(NID_undef);
  388.   	return((*op)->nid);
  389.   	}
          ^
  390.   
  391.   /* Convert an object name into an ASN1_OBJECT

crypto/objects/obj_dat.c:450:7: Taking false branch
448.   
449.   	nid=OBJ_obj2nid(a);
450.   	if ((nid == NID_undef) || no_name) {
             ^
451.   		len=a->length;
452.   		p=a->data;

crypto/objects/obj_dat.c:450:28: Taking false branch
448.   
449.   	nid=OBJ_obj2nid(a);
450.   	if ((nid == NID_undef) || no_name) {
                                  ^
451.   		len=a->length;
452.   		p=a->data;

crypto/objects/obj_dat.c:490:3: 
488.   		}
489.   	} else {
490. > 		s=OBJ_nid2ln(nid);
491.   		if (s == NULL)
492.   			s=OBJ_nid2sn(nid);

crypto/objects/obj_dat.c:335:1: start of procedure OBJ_nid2ln()
  333.   	}
  334.   
  335. > const char *OBJ_nid2ln(int n)
  336.   	{
  337.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:340:7: Taking true branch
  338.   	ASN1_OBJECT ob;
  339.   
  340.   	if ((n >= 0) && (n < NUM_NID))
               ^
  341.   		{
  342.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:340:19: Taking true branch
  338.   	ASN1_OBJECT ob;
  339.   
  340.   	if ((n >= 0) && (n < NUM_NID))
                           ^
  341.   		{
  342.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:342:8: Taking true branch
  340.   	if ((n >= 0) && (n < NUM_NID))
  341.   		{
  342.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                ^
  343.   			{
  344.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:342:28: Taking true branch
  340.   	if ((n >= 0) && (n < NUM_NID))
  341.   		{
  342.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                                    ^
  343.   			{
  344.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:344:4: 
  342.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
  343.   			{
  344. > 			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  345.   			return(NULL);
  346.   			}

crypto/err/err.c:361:1: start of procedure ERR_put_error()
    359.   /********************************************************/
    360.   
    361. > void ERR_put_error(int lib, int func, int reason, const char *file,
    362.   	     int line)
    363.   	{

crypto/err/err.c:385:2: Skipping ERR_get_state(): empty list of specs
    383.   	}
    384.   #endif
    385.   	es=ERR_get_state();
            ^
    386.   
    387.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:387:2: 
    385.   	es=ERR_get_state();
    386.   
    387. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    388.   	if (es->top == es->bottom)
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:388:6: Taking false branch
    386.   
    387.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    388.   	if (es->top == es->bottom)
                ^
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:390:2: 
    388.   	if (es->top == es->bottom)
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;

crypto/err/err.c:391:2: 
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391. > 	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);

crypto/err/err.c:392:2: 
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391.   	es->err_file[es->top]=file;
    392. > 	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
    394.   	}

crypto/err/err.c:393:2: Taking true branch
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
            ^
    394.   	}
    395.   

crypto/err/err.c:393:2: Taking true branch
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
            ^
    394.   	}
    395.   

crypto/mem.c:241:1: start of procedure CRYPTO_free()
      239.   	}
      240.   
      241. > void CRYPTO_free(void *str)
      242.   	{
      243.   	if (free_debug_func != NULL)

crypto/mem.c:243:6: Taking true branch
      241.   void CRYPTO_free(void *str)
      242.   	{
      243.   	if (free_debug_func != NULL)
                  ^
      244.   		free_debug_func(str, 0);
      245.   #ifdef LEVITTE_DEBUG_MEM

crypto/mem.c:244:3: Skipping __function_pointer__(): unresolved function pointer
      242.   	{
      243.   	if (free_debug_func != NULL)
      244.   		free_debug_func(str, 0);
               ^
      245.   #ifdef LEVITTE_DEBUG_MEM
      246.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);

crypto/mem.c:248:2: Skipping __function_pointer__(): unresolved function pointer
      246.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
      247.   #endif
      248.   	free_func(str);
              ^
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);

crypto/mem.c:249:6: Taking true branch
      247.   #endif
      248.   	free_func(str);
      249.   	if (free_debug_func != NULL)
                  ^
      250.   		free_debug_func(NULL, 1);
      251.   	}

crypto/mem.c:250:3: Skipping __function_pointer__(): unresolved function pointer
      248.   	free_func(str);
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
               ^
      251.   	}
      252.   

crypto/mem.c:249:2: 
      247.   #endif
      248.   	free_func(str);
      249. > 	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
      251.   	}

crypto/mem.c:251:2: return from a call to CRYPTO_free
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
      251.   	}
              ^
      252.   
      253.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

crypto/err/err.c:393:2: 
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393. > 	err_clear_data(es,es->top);
    394.   	}
    395.   

crypto/err/err.c:394:2: return from a call to ERR_put_error
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
    394.   	}
            ^
    395.   
    396.   void ERR_clear_error(void)

crypto/objects/obj_dat.c:345:4: 
  343.   			{
  344.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  345. > 			return(NULL);
  346.   			}
  347.   		return(nid_objs[n].ln);

crypto/objects/obj_dat.c:365:2: return from a call to OBJ_nid2ln
  363.   			}
  364.   		}
  365.   	}
          ^
  366.   
  367.   int OBJ_obj2nid(const ASN1_OBJECT *a)

crypto/objects/obj_dat.c:491:7: Taking true branch
489.   	} else {
490.   		s=OBJ_nid2ln(nid);
491.   		if (s == NULL)
             ^
492.   			s=OBJ_nid2sn(nid);
493.   		strncpy(buf,s,buf_len);

crypto/objects/obj_dat.c:492:4: 
490.   		s=OBJ_nid2ln(nid);
491.   		if (s == NULL)
492. > 			s=OBJ_nid2sn(nid);
493.   		strncpy(buf,s,buf_len);
494.   		n=strlen(s);

crypto/objects/obj_dat.c:303:1: start of procedure OBJ_nid2sn()
  301.   	}
  302.   
  303. > const char *OBJ_nid2sn(int n)
  304.   	{
  305.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:308:7: Taking true branch
  306.   	ASN1_OBJECT ob;
  307.   
  308.   	if ((n >= 0) && (n < NUM_NID))
               ^
  309.   		{
  310.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:308:19: Taking true branch
  306.   	ASN1_OBJECT ob;
  307.   
  308.   	if ((n >= 0) && (n < NUM_NID))
                           ^
  309.   		{
  310.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:310:8: Taking true branch
  308.   	if ((n >= 0) && (n < NUM_NID))
  309.   		{
  310.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                ^
  311.   			{
  312.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:310:28: Taking true branch
  308.   	if ((n >= 0) && (n < NUM_NID))
  309.   		{
  310.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                                    ^
  311.   			{
  312.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:312:4: 
  310.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
  311.   			{
  312. > 			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  313.   			return(NULL);
  314.   			}

crypto/err/err.c:361:1: start of procedure ERR_put_error()
    359.   /********************************************************/
    360.   
    361. > void ERR_put_error(int lib, int func, int reason, const char *file,
    362.   	     int line)
    363.   	{

crypto/err/err.c:385:2: Skipping ERR_get_state(): empty list of specs
    383.   	}
    384.   #endif
    385.   	es=ERR_get_state();
            ^
    386.   
    387.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:387:2: 
    385.   	es=ERR_get_state();
    386.   
    387. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    388.   	if (es->top == es->bottom)
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:388:6: Taking false branch
    386.   
    387.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    388.   	if (es->top == es->bottom)
                ^
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:390:2: 
    388.   	if (es->top == es->bottom)
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;

crypto/err/err.c:391:2: 
    389.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391. > 	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);

crypto/err/err.c:392:2: 
    390.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    391.   	es->err_file[es->top]=file;
    392. > 	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
    394.   	}

crypto/err/err.c:393:2: Taking true branch
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
            ^
    394.   	}
    395.   

crypto/err/err.c:393:2: Taking true branch
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
            ^
    394.   	}
    395.   

crypto/mem.c:241:1: start of procedure CRYPTO_free()
      239.   	}
      240.   
      241. > void CRYPTO_free(void *str)
      242.   	{
      243.   	if (free_debug_func != NULL)

crypto/mem.c:243:6: Taking true branch
      241.   void CRYPTO_free(void *str)
      242.   	{
      243.   	if (free_debug_func != NULL)
                  ^
      244.   		free_debug_func(str, 0);
      245.   #ifdef LEVITTE_DEBUG_MEM

crypto/mem.c:244:3: Skipping __function_pointer__(): unresolved function pointer
      242.   	{
      243.   	if (free_debug_func != NULL)
      244.   		free_debug_func(str, 0);
               ^
      245.   #ifdef LEVITTE_DEBUG_MEM
      246.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);

crypto/mem.c:248:2: Skipping __function_pointer__(): unresolved function pointer
      246.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
      247.   #endif
      248.   	free_func(str);
              ^
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);

crypto/mem.c:249:6: Taking true branch
      247.   #endif
      248.   	free_func(str);
      249.   	if (free_debug_func != NULL)
                  ^
      250.   		free_debug_func(NULL, 1);
      251.   	}

crypto/mem.c:250:3: Skipping __function_pointer__(): unresolved function pointer
      248.   	free_func(str);
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
               ^
      251.   	}
      252.   

crypto/mem.c:249:2: 
      247.   #endif
      248.   	free_func(str);
      249. > 	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
      251.   	}

crypto/mem.c:251:2: return from a call to CRYPTO_free
      249.   	if (free_debug_func != NULL)
      250.   		free_debug_func(NULL, 1);
      251.   	}
              ^
      252.   
      253.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

crypto/err/err.c:393:2: 
    391.   	es->err_file[es->top]=file;
    392.   	es->err_line[es->top]=line;
    393. > 	err_clear_data(es,es->top);
    394.   	}
    395.   

crypto/err/err.c:394:2: return from a call to ERR_put_error
    392.   	es->err_line[es->top]=line;
    393.   	err_clear_data(es,es->top);
    394.   	}
            ^
    395.   
    396.   void ERR_clear_error(void)

crypto/objects/obj_dat.c:313:4: 
  311.   			{
  312.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  313. > 			return(NULL);
  314.   			}
  315.   		return(nid_objs[n].sn);

crypto/objects/obj_dat.c:333:2: return from a call to OBJ_nid2sn
  331.   			}
  332.   		}
  333.   	}
          ^
  334.   
  335.   const char *OBJ_nid2ln(int n)

crypto/objects/obj_dat.c:493:3: 
491.   		if (s == NULL)
492.   			s=OBJ_nid2sn(nid);
493. > 		strncpy(buf,s,buf_len);
494.   		n=strlen(s);
495.   	}
