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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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:336:4: 
  334.   			{
  335.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  336. > 			return(NULL);
  337.   			}
  338.   		return(nid_objs[n].ln);

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

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

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

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

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

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

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

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

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

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:304:4: 
  302.   			{
  303.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  304. > 			return(NULL);
  305.   			}
  306.   		return(nid_objs[n].sn);

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

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