crypto/asn1/p5_pbe.c:144: error: BUFFER_OVERRUN_L3
  Offset: [1, +oo] Size: [0, +oo] by call to `i2d_PBEPARAM`.
Showing all 15 steps of the trace


crypto/asn1/p5_pbe.c:135:15: Call
133.   	if (salt) memcpy (pbe->salt->data, salt, saltlen);
134.   	else RAND_bytes (pbe->salt->data, saltlen);
135.   	if (!(plen = i2d_PBEPARAM (pbe, NULL))) {
                     ^
136.   		ASN1err(ASN1_F_ASN1_PBE_SET,ASN1_R_ENCODE_ERROR);
137.   		return NULL;

crypto/asn1/p5_pbe.c:70:2: Assignment
  68.   int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp)
  69.   {
  70.   	M_ASN1_I2D_vars(a);
         ^
  71.   	M_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING);
  72.   	M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);

crypto/asn1/p5_pbe.c:135:8: Assignment
133.   	if (salt) memcpy (pbe->salt->data, salt, saltlen);
134.   	else RAND_bytes (pbe->salt->data, saltlen);
135.   	if (!(plen = i2d_PBEPARAM (pbe, NULL))) {
              ^
136.   		ASN1err(ASN1_F_ASN1_PBE_SET,ASN1_R_ENCODE_ERROR);
137.   		return NULL;

crypto/asn1/p5_pbe.c:139:16: Array declaration
137.   		return NULL;
138.   	}
139.   	if (!(pdata = Malloc (plen))) {
                      ^
140.   		ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
141.   		return NULL;

crypto/asn1/p5_pbe.c:139:8: Assignment
137.   		return NULL;
138.   	}
139.   	if (!(pdata = Malloc (plen))) {
              ^
140.   		ASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);
141.   		return NULL;

crypto/asn1/p5_pbe.c:143:2: Assignment
141.   		return NULL;
142.   	}
143.   	ptmp = pdata;
        ^
144.   	i2d_PBEPARAM (pbe, &ptmp);
145.   	PBEPARAM_free (pbe);

crypto/asn1/p5_pbe.c:144:2: Call
142.   	}
143.   	ptmp = pdata;
144.   	i2d_PBEPARAM (pbe, &ptmp);
        ^
145.   	PBEPARAM_free (pbe);
146.   

crypto/asn1/p5_pbe.c:68:1: Parameter `**pp`
  66.   #define PKCS5_SALT_LEN	8
  67.   
  68. > int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp)
  69.   {
  70.   	M_ASN1_I2D_vars(a);

crypto/asn1/p5_pbe.c:74:2: Assignment
  72.   	M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);
  73.   
  74.   	M_ASN1_I2D_seq_total ();
         ^
  75.   
  76.   	M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING);

crypto/asn1/p5_pbe.c:74:2: Call
  72.   	M_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);
  73.   
  74.   	M_ASN1_I2D_seq_total ();
         ^
  75.   
  76.   	M_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING);

crypto/asn1/asn1_lib.c:180:1: <Length trace>
178.   /* class 0 is constructed
179.    * constructed == 2 for indefinitle length constructed */
180. > void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
181.   	     int xclass)
182.   	{

crypto/asn1/asn1_lib.c:180:1: Parameter `**pp`
    178.   /* class 0 is constructed
    179.    * constructed == 2 for indefinitle length constructed */
    180. > void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
    181.   	     int xclass)
    182.   	{

crypto/asn1/asn1_lib.c:183:2: Assignment
    181.   	     int xclass)
    182.   	{
    183.   	unsigned char *p= *pp;
            ^
    184.   	int i;
    185.   

crypto/asn1/asn1_lib.c:192:5: Assignment
    190.   	else
    191.   		{
    192.   		*(p++)=i|V_ASN1_PRIMATIVE_TAG;
               ^
    193.   		while (tag > 0x7f)
    194.   			{

crypto/asn1/asn1_lib.c:198:3: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `i2d_PBEPARAM` 
    196.   			tag>>=7;
    197.   			}
    198.   		*(p++)=(tag&0x7f);
             ^
    199.   		}
    200.   	if ((constructed == 2) && (length == 0))

void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
	     int xclass)
	{
	unsigned char *p= *pp;
	int i;
	i=(constructed)?V_ASN1_CONSTRUCTED:0;
	i|=(xclass&V_ASN1_PRIVATE);
	if (tag < 31)
		*(p++)=i|(tag&V_ASN1_PRIMATIVE_TAG);
	else
		{
		*(p++)=i|V_ASN1_PRIMATIVE_TAG;
		while (tag > 0x7f)
			{
			*(p++)=(tag&0x7f)|0x80;
			tag>>=7;
			}
		*(p++)=(tag&0x7f);
		}
	if ((constructed == 2) && (length == 0))
		*(p++)=0x80;
	else
		asn1_put_length(&p,length);
	*pp=p;
	}
['X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,\n\t     int saltlen)\n{\n\tunsigned char *pdata, *ptmp;\n\tint plen;\n\tPBEPARAM *pbe;\n\tASN1_OBJECT *al;\n\tX509_ALGOR *algor;\n\tASN1_TYPE *astype;\n\tif (!(pbe = PBEPARAM_new ())) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tASN1_INTEGER_set (pbe->iter, iter);\n\tif (!saltlen) saltlen = PKCS5_SALT_LEN;\n\tif (!(pbe->salt->data = Malloc (saltlen))) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tpbe->salt->length = saltlen;\n\tif (salt) memcpy (pbe->salt->data, salt, saltlen);\n\telse RAND_bytes (pbe->salt->data, saltlen);\n\tif (!(plen = i2d_PBEPARAM (pbe, NULL))) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ASN1_R_ENCODE_ERROR);\n\t\treturn NULL;\n\t}\n\tif (!(pdata = Malloc (plen))) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tptmp = pdata;\n\ti2d_PBEPARAM (pbe, &ptmp);\n\tPBEPARAM_free (pbe);\n\tif (!(astype = ASN1_TYPE_new())) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tastype->type = V_ASN1_SEQUENCE;\n\tif (!(astype->value.sequence=ASN1_STRING_new())) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tASN1_STRING_set (astype->value.sequence, pdata, plen);\n\tFree (pdata);\n\tal = OBJ_nid2obj(alg);\n\tif (!(algor = X509_ALGOR_new())) {\n\t\tASN1err(ASN1_F_ASN1_PBE_SET,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t}\n\tASN1_OBJECT_free(algor->algorithm);\n\talgor->algorithm = al;\n\talgor->parameter = astype;\n\treturn (algor);\n}', 'int i2d_PBEPARAM(PBEPARAM *a, unsigned char **pp)\n{\n\tM_ASN1_I2D_vars(a);\n\tM_ASN1_I2D_len (a->salt, i2d_ASN1_OCTET_STRING);\n\tM_ASN1_I2D_len (a->iter, i2d_ASN1_INTEGER);\n\tM_ASN1_I2D_seq_total ();\n\tM_ASN1_I2D_put (a->salt, i2d_ASN1_OCTET_STRING);\n\tM_ASN1_I2D_put (a->iter, i2d_ASN1_INTEGER);\n\tM_ASN1_I2D_finish();\n}', 'void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,\n\t     int xclass)\n\t{\n\tunsigned char *p= *pp;\n\tint i;\n\ti=(constructed)?V_ASN1_CONSTRUCTED:0;\n\ti|=(xclass&V_ASN1_PRIVATE);\n\tif (tag < 31)\n\t\t*(p++)=i|(tag&V_ASN1_PRIMATIVE_TAG);\n\telse\n\t\t{\n\t\t*(p++)=i|V_ASN1_PRIMATIVE_TAG;\n\t\twhile (tag > 0x7f)\n\t\t\t{\n\t\t\t*(p++)=(tag&0x7f)|0x80;\n\t\t\ttag>>=7;\n\t\t\t}\n\t\t*(p++)=(tag&0x7f);\n\t\t}\n\tif ((constructed == 2) && (length == 0))\n\t\t*(p++)=0x80;\n\telse\n\t\tasn1_put_length(&p,length);\n\t*pp=p;\n\t}']