if (!BUF_MEM_grow(buf,4+n+j+2))
if (!BUF_MEM_grow_clean(buf,4+n+j+2))
static int ssl3_send_certificate_request(SSL *s)	{	unsigned char *p,*d;	int i,j,nl,off,n;	STACK_OF(X509_NAME) *sk=NULL;	X509_NAME *name;	BUF_MEM *buf;	if (s->state == SSL3_ST_SW_CERT_REQ_A)		{		buf=s->init_buf;		d=p=(unsigned char *)&(buf->data[4]);		/* get the list of acceptable cert types */		p++;		n=ssl3_get_req_cert_type(s,p);		d[0]=n;		p+=n;		n++;		off=n;		p+=2;		n+=2;		sk=SSL_get_client_CA_list(s);		nl=0;		if (sk != NULL)			{			for (i=0; i<sk_X509_NAME_num(sk); i++)				{				name=sk_X509_NAME_value(sk,i);				j=i2d_X509_NAME(name,NULL);				if (!BUF_MEM_grow(buf,4+n+j+2))					{					SSLerr(SSL_F_SSL3_SEND_CERTIFICATE_REQUEST,ERR_R_BUF_LIB);					goto err;					}				p=(unsigned char *)&(buf->data[4+n]);				if (!(s->options & SSL_OP_NETSCAPE_CA_DN_BUG))					{					s2n(j,p);					i2d_X509_NAME(name,&p);					n+=2+j;					nl+=2+j;					}				else					{					d=p;					i2d_X509_NAME(name,&p);					j-=2; s2n(j,d); j+=2;					n+=j;					nl+=j;					}				}			}		/* else no CA names */		p=(unsigned char *)&(buf->data[4+off]);		s2n(nl,p);		d=(unsigned char *)buf->data;		*(d++)=SSL3_MT_CERTIFICATE_REQUEST;		l2n3(n,d);		/* we should now have things packed up, so lets send		 * it off */		s->init_num=n+4;		s->init_off=0;#ifdef NETSCAPE_HANG_BUG		p=(unsigned char *)s->init_buf->data + s->init_num;		/* do the header */		*(p++)=SSL3_MT_SERVER_DONE;		*(p++)=0;		*(p++)=0;		*(p++)=0;		s->init_num += 4;#endif		}	/* SSL3_ST_SW_CERT_REQ_B */	return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));err:	return(-1);	}