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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/err/err.c:617:1: start of procedure ERR_put_error()
    615.   /********************************************************/
    616.   
    617. > void ERR_put_error(int lib, int func, int reason, const char *file,
    618.   	     int line)
    619.   	{

crypto/err/err.c:641:2: Skipping ERR_get_state(): empty list of specs
    639.   	}
    640.   #endif
    641.   	es=ERR_get_state();
            ^
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:643:2: 
    641.   	es=ERR_get_state();
    642.   
    643. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:644:6: Taking false branch
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
                ^
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:646:2: 
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;

crypto/err/err.c:647:2: 
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647. > 	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);

crypto/err/err.c:648:2: 
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648. > 	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}

crypto/err/err.c:649:2: Taking true branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/err/err.c:649:2: Taking true branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/mem.c:321:1: start of procedure CRYPTO_free()
      319.   	}
      320.   
      321. > void CRYPTO_free(void *str)
      322.   	{
      323.   	if (free_debug_func != NULL)

crypto/mem.c:323:6: Taking true branch
      321.   void CRYPTO_free(void *str)
      322.   	{
      323.   	if (free_debug_func != NULL)
                  ^
      324.   		free_debug_func(str, 0);
      325.   #ifdef LEVITTE_DEBUG_MEM

crypto/mem.c:324:3: Skipping __function_pointer__(): unresolved function pointer
      322.   	{
      323.   	if (free_debug_func != NULL)
      324.   		free_debug_func(str, 0);
               ^
      325.   #ifdef LEVITTE_DEBUG_MEM
      326.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);

crypto/mem.c:328:2: Skipping __function_pointer__(): unresolved function pointer
      326.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
      327.   #endif
      328.   	free_func(str);
              ^
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);

crypto/mem.c:329:6: Taking true branch
      327.   #endif
      328.   	free_func(str);
      329.   	if (free_debug_func != NULL)
                  ^
      330.   		free_debug_func(NULL, 1);
      331.   	}

crypto/mem.c:330:3: Skipping __function_pointer__(): unresolved function pointer
      328.   	free_func(str);
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
               ^
      331.   	}
      332.   

crypto/mem.c:329:2: 
      327.   #endif
      328.   	free_func(str);
      329. > 	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
      331.   	}

crypto/mem.c:331:2: return from a call to CRYPTO_free
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
      331.   	}
              ^
      332.   
      333.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

crypto/err/err.c:649:2: 
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649. > 	err_clear_data(es,es->top);
    650.   	}
    651.   

crypto/err/err.c:650:2: return from a call to ERR_put_error
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}
            ^
    651.   
    652.   void ERR_clear_error(void)

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

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

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

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

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

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

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

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

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

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

crypto/err/err.c:617:1: start of procedure ERR_put_error()
    615.   /********************************************************/
    616.   
    617. > void ERR_put_error(int lib, int func, int reason, const char *file,
    618.   	     int line)
    619.   	{

crypto/err/err.c:641:2: Skipping ERR_get_state(): empty list of specs
    639.   	}
    640.   #endif
    641.   	es=ERR_get_state();
            ^
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:643:2: 
    641.   	es=ERR_get_state();
    642.   
    643. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:644:6: Taking false branch
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
                ^
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:646:2: 
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;

crypto/err/err.c:647:2: 
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647. > 	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);

crypto/err/err.c:648:2: 
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648. > 	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}

crypto/err/err.c:649:2: Taking true branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/err/err.c:649:2: Taking true branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/mem.c:321:1: start of procedure CRYPTO_free()
      319.   	}
      320.   
      321. > void CRYPTO_free(void *str)
      322.   	{
      323.   	if (free_debug_func != NULL)

crypto/mem.c:323:6: Taking true branch
      321.   void CRYPTO_free(void *str)
      322.   	{
      323.   	if (free_debug_func != NULL)
                  ^
      324.   		free_debug_func(str, 0);
      325.   #ifdef LEVITTE_DEBUG_MEM

crypto/mem.c:324:3: Skipping __function_pointer__(): unresolved function pointer
      322.   	{
      323.   	if (free_debug_func != NULL)
      324.   		free_debug_func(str, 0);
               ^
      325.   #ifdef LEVITTE_DEBUG_MEM
      326.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);

crypto/mem.c:328:2: Skipping __function_pointer__(): unresolved function pointer
      326.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
      327.   #endif
      328.   	free_func(str);
              ^
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);

crypto/mem.c:329:6: Taking true branch
      327.   #endif
      328.   	free_func(str);
      329.   	if (free_debug_func != NULL)
                  ^
      330.   		free_debug_func(NULL, 1);
      331.   	}

crypto/mem.c:330:3: Skipping __function_pointer__(): unresolved function pointer
      328.   	free_func(str);
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
               ^
      331.   	}
      332.   

crypto/mem.c:329:2: 
      327.   #endif
      328.   	free_func(str);
      329. > 	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
      331.   	}

crypto/mem.c:331:2: return from a call to CRYPTO_free
      329.   	if (free_debug_func != NULL)
      330.   		free_debug_func(NULL, 1);
      331.   	}
              ^
      332.   
      333.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

crypto/err/err.c:649:2: 
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649. > 	err_clear_data(es,es->top);
    650.   	}
    651.   

crypto/err/err.c:650:2: return from a call to ERR_put_error
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}
            ^
    651.   
    652.   void ERR_clear_error(void)

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

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

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