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


crypto/objects/obj_dat.c:423:1: start of procedure OBJ_obj2txt()
421.   	}
422.   
423. > int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name)
424.   {
425.   	int i,idx=0,n=0,len,nid;

crypto/objects/obj_dat.c:425:2: 
423.   int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name)
424.   {
425. > 	int i,idx=0,n=0,len,nid;
426.   	unsigned long l;
427.   	unsigned char *p;

crypto/objects/obj_dat.c:431:6: Taking false branch
429.   	char tbuf[32];
430.   
431.   	if (buf_len <= 0) return(0);
            ^
432.   
433.   	if ((a == NULL) || (a->data == NULL)) {

crypto/objects/obj_dat.c:433:7: Taking false branch
431.   	if (buf_len <= 0) return(0);
432.   
433.   	if ((a == NULL) || (a->data == NULL)) {
             ^
434.   		buf[0]='\0';
435.   		return(0);

crypto/objects/obj_dat.c:433:22: Taking false branch
431.   	if (buf_len <= 0) return(0);
432.   
433.   	if ((a == NULL) || (a->data == NULL)) {
                            ^
434.   		buf[0]='\0';
435.   		return(0);

crypto/objects/obj_dat.c:438:2: 
436.   	}
437.   
438. > 	nid=OBJ_obj2nid(a);
439.   	if ((nid == NID_undef) || no_name) {
440.   		len=a->length;

crypto/objects/obj_dat.c:356:1: start of procedure OBJ_obj2nid()
  354.   	}
  355.   
  356. > int OBJ_obj2nid(ASN1_OBJECT *a)
  357.   	{
  358.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:361:6: Taking false branch
  359.   	ADDED_OBJ ad,*adp;
  360.   
  361.   	if (a == NULL)
              ^
  362.   		return(NID_undef);
  363.   	if (a->nid != 0)

crypto/objects/obj_dat.c:363:6: Taking true branch
  361.   	if (a == NULL)
  362.   		return(NID_undef);
  363.   	if (a->nid != 0)
              ^
  364.   		return(a->nid);
  365.   

crypto/objects/obj_dat.c:364:3: 
  362.   		return(NID_undef);
  363.   	if (a->nid != 0)
  364. > 		return(a->nid);
  365.   
  366.   	if (added != NULL)

crypto/objects/obj_dat.c:378:2: return from a call to OBJ_obj2nid
  376.   		return(NID_undef);
  377.   	return((*op)->nid);
  378.   	}
          ^
  379.   
  380.   /* Convert an object name into an ASN1_OBJECT

crypto/objects/obj_dat.c:439:7: Taking false branch
437.   
438.   	nid=OBJ_obj2nid(a);
439.   	if ((nid == NID_undef) || no_name) {
             ^
440.   		len=a->length;
441.   		p=a->data;

crypto/objects/obj_dat.c:439:28: Taking false branch
437.   
438.   	nid=OBJ_obj2nid(a);
439.   	if ((nid == NID_undef) || no_name) {
                                  ^
440.   		len=a->length;
441.   		p=a->data;

crypto/objects/obj_dat.c:479:3: 
477.   		}
478.   	} else {
479. > 		s=OBJ_nid2ln(nid);
480.   		if (s == NULL)
481.   			s=OBJ_nid2sn(nid);

crypto/objects/obj_dat.c:324:1: start of procedure OBJ_nid2ln()
  322.   	}
  323.   
  324. > const char *OBJ_nid2ln(int n)
  325.   	{
  326.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:329:7: Taking true branch
  327.   	ASN1_OBJECT ob;
  328.   
  329.   	if ((n >= 0) && (n < NUM_NID))
               ^
  330.   		{
  331.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:329:19: Taking true branch
  327.   	ASN1_OBJECT ob;
  328.   
  329.   	if ((n >= 0) && (n < NUM_NID))
                           ^
  330.   		{
  331.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:331:8: Taking true branch
  329.   	if ((n >= 0) && (n < NUM_NID))
  330.   		{
  331.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                ^
  332.   			{
  333.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:331:28: Taking true branch
  329.   	if ((n >= 0) && (n < NUM_NID))
  330.   		{
  331.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                                    ^
  332.   			{
  333.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:333:4: 
  331.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
  332.   			{
  333. > 			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  334.   			return(NULL);
  335.   			}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
    351.   /********************************************************/
    352.   
    353. > void ERR_put_error(int lib, int func, int reason, const char *file,
    354.   	     int line)
    355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
    375.   	}
    376.   #endif
    377.   	es=ERR_get_state();
            ^
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
    377.   	es=ERR_get_state();
    378.   
    379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
                ^
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383. > 	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384. > 	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

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

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
      246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 0x%p\n", str);

crypto/mem.c:248:2: Skipping __function_pointer__(): unresolved function pointer
      246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 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:385:2: 
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385. > 	err_clear_data(es,es->top);
    386.   	}
    387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}
            ^
    387.   
    388.   void ERR_clear_error(void)

crypto/objects/obj_dat.c:334:4: 
  332.   			{
  333.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  334. > 			return(NULL);
  335.   			}
  336.   		return(nid_objs[n].ln);

crypto/objects/obj_dat.c:354:2: return from a call to OBJ_nid2ln
  352.   			}
  353.   		}
  354.   	}
          ^
  355.   
  356.   int OBJ_obj2nid(ASN1_OBJECT *a)

crypto/objects/obj_dat.c:480:7: Taking true branch
478.   	} else {
479.   		s=OBJ_nid2ln(nid);
480.   		if (s == NULL)
             ^
481.   			s=OBJ_nid2sn(nid);
482.   		strncpy(buf,s,buf_len);

crypto/objects/obj_dat.c:481:4: 
479.   		s=OBJ_nid2ln(nid);
480.   		if (s == NULL)
481. > 			s=OBJ_nid2sn(nid);
482.   		strncpy(buf,s,buf_len);
483.   		n=strlen(s);

crypto/objects/obj_dat.c:292:1: start of procedure OBJ_nid2sn()
  290.   	}
  291.   
  292. > const char *OBJ_nid2sn(int n)
  293.   	{
  294.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:297:7: Taking true branch
  295.   	ASN1_OBJECT ob;
  296.   
  297.   	if ((n >= 0) && (n < NUM_NID))
               ^
  298.   		{
  299.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:297:19: Taking true branch
  295.   	ASN1_OBJECT ob;
  296.   
  297.   	if ((n >= 0) && (n < NUM_NID))
                           ^
  298.   		{
  299.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:299:8: Taking true branch
  297.   	if ((n >= 0) && (n < NUM_NID))
  298.   		{
  299.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                ^
  300.   			{
  301.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:299:28: Taking true branch
  297.   	if ((n >= 0) && (n < NUM_NID))
  298.   		{
  299.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
                                    ^
  300.   			{
  301.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:301:4: 
  299.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
  300.   			{
  301. > 			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  302.   			return(NULL);
  303.   			}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
    351.   /********************************************************/
    352.   
    353. > void ERR_put_error(int lib, int func, int reason, const char *file,
    354.   	     int line)
    355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
    375.   	}
    376.   #endif
    377.   	es=ERR_get_state();
            ^
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
    377.   	es=ERR_get_state();
    378.   
    379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
                ^
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383. > 	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384. > 	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

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

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
      246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 0x%p\n", str);

crypto/mem.c:248:2: Skipping __function_pointer__(): unresolved function pointer
      246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 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:385:2: 
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385. > 	err_clear_data(es,es->top);
    386.   	}
    387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}
            ^
    387.   
    388.   void ERR_clear_error(void)

crypto/objects/obj_dat.c:302:4: 
  300.   			{
  301.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  302. > 			return(NULL);
  303.   			}
  304.   		return(nid_objs[n].sn);

crypto/objects/obj_dat.c:322:2: return from a call to OBJ_nid2sn
  320.   			}
  321.   		}
  322.   	}
          ^
  323.   
  324.   const char *OBJ_nid2ln(int n)

crypto/objects/obj_dat.c:482:3: 
480.   		if (s == NULL)
481.   			s=OBJ_nid2sn(nid);
482. > 		strncpy(buf,s,buf_len);
483.   		n=strlen(s);
484.   	}
