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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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:394:2: 
    392.   	es->err_file[es->top]=file;
    393.   	es->err_line[es->top]=line;
    394. > 	err_clear_data(es,es->top);
    395.   	}
    396.   

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

crypto/objects/obj_dat.c:339:4: 
  337.   			{
  338.   			OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
  339. > 			return(NULL);
  340.   			}
  341.   		return(nid_objs[n].ln);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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:394:2: 
    392.   	es->err_file[es->top]=file;
    393.   	es->err_line[es->top]=line;
    394. > 	err_clear_data(es,es->top);
    395.   	}
    396.   

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

crypto/objects/obj_dat.c:307:4: 
  305.   			{
  306.   			OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
  307. > 			return(NULL);
  308.   			}
  309.   		return(nid_objs[n].sn);

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

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