crypto/asn1/x_pubkey.c:165: error: BUFFER_OVERRUN_L3
  Offset: [2, +oo] (⇐ [2, +oo] + [0, +oo]) Size: [0, +oo] by call to `i2d_DSAparams`.
Showing all 22 steps of the trace


crypto/asn1/x_pubkey.c:162:5: Call
160.   		dsa->write_params=0;
161.   		ASN1_TYPE_free(a->parameter);
162.   		i=i2d_DSAparams(dsa,NULL);
           ^
163.   		p=(unsigned char *)Malloc(i);
164.   		pp=p;

crypto/asn1/i2d_dsap.c:77:17: Assignment
  75.   	unsigned char *p;
  76.   
  77.   	if (a == NULL) return(0);
                        ^
  78.   	num[0]=a->p;
  79.   	num[1]=a->q;

crypto/asn1/x_pubkey.c:162:3: Assignment
160.   		dsa->write_params=0;
161.   		ASN1_TYPE_free(a->parameter);
162.   		i=i2d_DSAparams(dsa,NULL);
         ^
163.   		p=(unsigned char *)Malloc(i);
164.   		pp=p;

crypto/asn1/x_pubkey.c:163:22: Array declaration
161.   		ASN1_TYPE_free(a->parameter);
162.   		i=i2d_DSAparams(dsa,NULL);
163.   		p=(unsigned char *)Malloc(i);
                            ^
164.   		pp=p;
165.   		i2d_DSAparams(dsa,&pp);

crypto/asn1/x_pubkey.c:163:3: Assignment
161.   		ASN1_TYPE_free(a->parameter);
162.   		i=i2d_DSAparams(dsa,NULL);
163.   		p=(unsigned char *)Malloc(i);
         ^
164.   		pp=p;
165.   		i2d_DSAparams(dsa,&pp);

crypto/asn1/x_pubkey.c:164:3: Assignment
162.   		i=i2d_DSAparams(dsa,NULL);
163.   		p=(unsigned char *)Malloc(i);
164.   		pp=p;
         ^
165.   		i2d_DSAparams(dsa,&pp);
166.   		a->parameter=ASN1_TYPE_new();

crypto/asn1/x_pubkey.c:165:3: Call
163.   		p=(unsigned char *)Malloc(i);
164.   		pp=p;
165.   		i2d_DSAparams(dsa,&pp);
         ^
166.   		a->parameter=ASN1_TYPE_new();
167.   		a->parameter->type=V_ASN1_SEQUENCE;

crypto/asn1/i2d_dsap.c:69:1: Parameter `**pp`
  67.    */
  68.   
  69. > int i2d_DSAparams(DSA *a, unsigned char **pp)
  70.   	{
  71.   	BIGNUM *num[3];

crypto/asn1/i2d_dsap.c:96:2: Assignment
  94.   	if (pp == NULL) return(t);
  95.   
  96.   	p= *pp;
         ^
  97.   	ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
  98.   

crypto/asn1/i2d_dsap.c:97:2: Call
  95.   
  96.   	p= *pp;
  97.   	ASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
          ^
  98.   
  99.   	bs.type=V_ASN1_INTEGER;

crypto/asn1/asn1_lib.c:186:1: Parameter `**pp`
    184.   /* class 0 is constructed
    185.    * constructed == 2 for indefinitle length constructed */
    186. > void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
    187.   	     int xclass)
    188.   	{

crypto/asn1/asn1_lib.c:189:2: Assignment
    187.   	     int xclass)
    188.   	{
    189.   	unsigned char *p= *pp;
            ^
    190.   	int i;
    191.   

crypto/asn1/asn1_lib.c:195:5: Assignment
    193.   	i|=(xclass&V_ASN1_PRIVATE);
    194.   	if (tag < 31)
    195.   		*(p++)=i|(tag&V_ASN1_PRIMATIVE_TAG);
               ^
    196.   	else
    197.   		{

crypto/asn1/asn1_lib.c:209:3: Call
    207.   		*(p++)=0x80; /* der_put_length would output 0 instead */
    208.   	else
    209.   		asn1_put_length(&p,length);
             ^
    210.   	*pp=p;
    211.   	}

crypto/asn1/asn1_lib.c:222:8: <Offset trace>
220.   		{
221.   		l=length;
222.   		for (i=0; l > 0; i++)
              ^
223.   			l>>=8;
224.   		*(p++)=i|0x80;

crypto/asn1/asn1_lib.c:222:8: Assignment
      220.   		{
      221.   		l=length;
      222.   		for (i=0; l > 0; i++)
                    ^
      223.   			l>>=8;
      224.   		*(p++)=i|0x80;

crypto/asn1/asn1_lib.c:226:10: Assignment
      224.   		*(p++)=i|0x80;
      225.   		l=i;
      226.   		while (i-- > 0)
                      ^
      227.   			{
      228.   			p[i]=length&0xff;

crypto/asn1/asn1_lib.c:213:1: <Length trace>
211.   	}
212.   
213. > static void asn1_put_length(unsigned char **pp, int length)
214.   	{
215.   	unsigned char *p= *pp;

crypto/asn1/asn1_lib.c:213:1: Parameter `**pp`
      211.   	}
      212.   
      213. > static void asn1_put_length(unsigned char **pp, int length)
      214.   	{
      215.   	unsigned char *p= *pp;

crypto/asn1/asn1_lib.c:215:2: Assignment
      213.   static void asn1_put_length(unsigned char **pp, int length)
      214.   	{
      215.   	unsigned char *p= *pp;
              ^
      216.   	int i,l;
      217.   	if (length <= 127)

crypto/asn1/asn1_lib.c:224:5: Assignment
      222.   		for (i=0; l > 0; i++)
      223.   			l>>=8;
      224.   		*(p++)=i|0x80;
                 ^
      225.   		l=i;
      226.   		while (i-- > 0)

crypto/asn1/asn1_lib.c:228:4: Array access: Offset: [2, +oo] (⇐ [2, +oo] + [0, +oo]) Size: [0, +oo] by call to `i2d_DSAparams` 
      226.   		while (i-- > 0)
      227.   			{
      228.   			p[i]=length&0xff;
                ^
      229.   			length>>=8;
      230.   			}

static void asn1_put_length(unsigned char **pp, int length)
	{
	unsigned char *p= *pp;
	int i,l;
	if (length <= 127)
		*(p++)=(unsigned char)length;
	else
		{
		l=length;
		for (i=0; l > 0; i++)
			l>>=8;
		*(p++)=i|0x80;
		l=i;
		while (i-- > 0)
			{
			p[i]=length&0xff;
			length>>=8;
			}
		p+=l;
		}
	*pp=p;
	}
['int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)\n\t{\n\tint ok=0;\n\tX509_PUBKEY *pk;\n\tX509_ALGOR *a;\n\tASN1_OBJECT *o;\n\tunsigned char *s,*p;\n\tint i;\n\tif (x == NULL) return(0);\n\tif ((pk=X509_PUBKEY_new()) == NULL) goto err;\n\ta=pk->algor;\n\tif ((o=OBJ_nid2obj(pkey->type)) == NULL) goto err;\n\tASN1_OBJECT_free(a->algorithm);\n\ta->algorithm=o;\n\tif (!pkey->save_parameters || (pkey->type == EVP_PKEY_RSA))\n\t\t{\n\t\tif ((a->parameter == NULL) ||\n\t\t\t(a->parameter->type != V_ASN1_NULL))\n\t\t\t{\n\t\t\tASN1_TYPE_free(a->parameter);\n\t\t\ta->parameter=ASN1_TYPE_new();\n\t\t\ta->parameter->type=V_ASN1_NULL;\n\t\t\t}\n\t\t}\n\telse\n#ifndef NO_DSA\n\t\tif (pkey->type == EVP_PKEY_DSA)\n\t\t{\n\t\tunsigned char *pp;\n\t\tDSA *dsa;\n\t\tdsa=pkey->pkey.dsa;\n\t\tdsa->write_params=0;\n\t\tASN1_TYPE_free(a->parameter);\n\t\ti=i2d_DSAparams(dsa,NULL);\n\t\tp=(unsigned char *)Malloc(i);\n\t\tpp=p;\n\t\ti2d_DSAparams(dsa,&pp);\n\t\ta->parameter=ASN1_TYPE_new();\n\t\ta->parameter->type=V_ASN1_SEQUENCE;\n\t\ta->parameter->value.sequence=ASN1_STRING_new();\n\t\tASN1_STRING_set(a->parameter->value.sequence,p,i);\n\t\tFree(p);\n\t\t}\n\telse\n#endif\n\t\t{\n\t\tX509err(X509_F_X509_PUBKEY_SET,X509_R_UNSUPPORTED_ALGORITHM);\n\t\tgoto err;\n\t\t}\n\tif ((i=i2d_PublicKey(pkey,NULL)) <= 0) goto err;\n\tif ((s=(unsigned char *)Malloc(i+1)) == NULL) goto err;\n\tp=s;\n\ti2d_PublicKey(pkey,&p);\n\tif (!ASN1_BIT_STRING_set(pk->public_key,s,i)) goto err;\n\tpk->public_key->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);\n\tpk->public_key->flags|=ASN1_STRING_FLAG_BITS_LEFT;\n\tFree(s);\n\tCRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);\n\tpk->pkey=pkey;\n\tif (*x != NULL)\n\t\tX509_PUBKEY_free(*x);\n\t*x=pk;\n\tpk=NULL;\n\tok=1;\nerr:\n\tif (pk != NULL) X509_PUBKEY_free(pk);\n\treturn(ok);\n\t}', 'int i2d_DSAparams(DSA *a, unsigned char **pp)\n\t{\n\tBIGNUM *num[3];\n\tASN1_INTEGER bs;\n\tunsigned int j,i,tot=0,len,max=0;\n\tint t,ret= -1;\n\tunsigned char *p;\n\tif (a == NULL) return(0);\n\tnum[0]=a->p;\n\tnum[1]=a->q;\n\tnum[2]=a->g;\n\tfor (i=0; i<3; i++)\n\t\t{\n\t\tif (num[i] == NULL) continue;\n\t\tj=BN_num_bits(num[i]);\n\t\tlen=((j == 0)?0:((j/8)+1));\n\t\tif (len > max) max=len;\n\t\tlen=ASN1_object_size(0,len,\n\t\t\t(num[i]->neg)?V_ASN1_NEG_INTEGER:V_ASN1_INTEGER);\n\t\ttot+=len;\n\t\t}\n\tt=ASN1_object_size(1,tot,V_ASN1_SEQUENCE);\n\tif (pp == NULL) return(t);\n\tp= *pp;\n\tASN1_put_object(&p,1,tot,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);\n\tbs.type=V_ASN1_INTEGER;\n\tbs.data=(unsigned char *)Malloc(max+4);\n\tif (bs.data == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_I2D_DSAPARAMS,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tfor (i=0; i<3; i++)\n\t\t{\n\t\tif (num[i] == NULL) continue;\n\t\tbs.length=BN_bn2bin(num[i],bs.data);\n\t\ti2d_ASN1_INTEGER(&bs,&p);\n\t\t}\n\tFree((char *)bs.data);\n\tret=t;\nerr:\n\t*pp=p;\n\treturn(ret);\n\t}', '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}', 'static void asn1_put_length(unsigned char **pp, int length)\n\t{\n\tunsigned char *p= *pp;\n\tint i,l;\n\tif (length <= 127)\n\t\t*(p++)=(unsigned char)length;\n\telse\n\t\t{\n\t\tl=length;\n\t\tfor (i=0; l > 0; i++)\n\t\t\tl>>=8;\n\t\t*(p++)=i|0x80;\n\t\tl=i;\n\t\twhile (i-- > 0)\n\t\t\t{\n\t\t\tp[i]=length&0xff;\n\t\t\tlength>>=8;\n\t\t\t}\n\t\tp+=l;\n\t\t}\n\t*pp=p;\n\t}']