apps/req.c:1530: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: 1024.
Showing all 6 steps of the trace


apps/req.c:1490:1: <Offset trace>
1488.   
1489.   
1490. > static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
1491.   	     int nid, int n_min, int n_max, unsigned long chtype, int mval)
1492.   	{

apps/req.c:1490:1: Array declaration
1488.   
1489.   
1490. > static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
1491.   	     int nid, int n_min, int n_max, unsigned long chtype, int mval)
1492.   	{

apps/req.c:1529:2: Assignment
1527.   	else if ((buf[0] == '.') && (buf[1] == '\n')) return(1);
1528.   
1529.   	i=strlen(buf);
         ^
1530.   	if (buf[i-1] != '\n')
1531.   		{

apps/req.c:1490:1: <Length trace>
1488.   
1489.   
1490. > static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
1491.   	     int nid, int n_min, int n_max, unsigned long chtype, int mval)
1492.   	{

apps/req.c:1490:1: Array declaration
1488.   
1489.   
1490. > static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
1491.   	     int nid, int n_min, int n_max, unsigned long chtype, int mval)
1492.   	{

apps/req.c:1530:6: Array access: Offset: [-1, +oo] Size: 1024
1528.   
1529.   	i=strlen(buf);
1530.   	if (buf[i-1] != '\n')
             ^
1531.   		{
1532.   		BIO_printf(bio_err,"weird input :-(\n");

static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
	     int nid, int n_min, int n_max, unsigned long chtype, int mval)
	{
	int i,ret=0;
	MS_STATIC char buf[1024];
start:
	if (!batch) BIO_printf(bio_err,"%s [%s]:",text,def);
	(void)BIO_flush(bio_err);
	if(value != NULL)
		{
		OPENSSL_assert(strlen(value) < sizeof buf-2);
		strcpy(buf,value);
		strcat(buf,"\n");
		BIO_printf(bio_err,"%s\n",value);
		}
	else
		{
		buf[0]='\0';
		if (!batch)
			{
			fgets(buf,sizeof buf,stdin);
			}
		else
			{
			buf[0] = '\n';
			buf[1] = '\0';
			}
		}
	if (buf[0] == '\0') return(0);
	else if (buf[0] == '\n')
		{
		if ((def == NULL) || (def[0] == '\0'))
			return(1);
		strcpy(buf,def);
		strcat(buf,"\n");
		}
	else if ((buf[0] == '.') && (buf[1] == '\n')) return(1);
	i=strlen(buf);
	if (buf[i-1] != '\n')
		{
		BIO_printf(bio_err,"weird input :-(\n");
		return(0);
		}
	buf[--i]='\0';
#ifdef CHARSET_EBCDIC
	ebcdic2ascii(buf, buf, i);
#endif
	if(!req_check_len(i, n_min, n_max)) goto start;
	if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
				(unsigned char *) buf, -1,-1,mval)) goto err;
	ret=1;
err:
	return(ret);
	}
['static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,\n\t     int nid, int n_min, int n_max, unsigned long chtype, int mval)\n\t{\n\tint i,ret=0;\n\tMS_STATIC char buf[1024];\nstart:\n\tif (!batch) BIO_printf(bio_err,"%s [%s]:",text,def);\n\t(void)BIO_flush(bio_err);\n\tif(value != NULL)\n\t\t{\n\t\tOPENSSL_assert(strlen(value) < sizeof buf-2);\n\t\tstrcpy(buf,value);\n\t\tstrcat(buf,"\\n");\n\t\tBIO_printf(bio_err,"%s\\n",value);\n\t\t}\n\telse\n\t\t{\n\t\tbuf[0]=\'\\0\';\n\t\tif (!batch)\n\t\t\t{\n\t\t\tfgets(buf,sizeof buf,stdin);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tbuf[0] = \'\\n\';\n\t\t\tbuf[1] = \'\\0\';\n\t\t\t}\n\t\t}\n\tif (buf[0] == \'\\0\') return(0);\n\telse if (buf[0] == \'\\n\')\n\t\t{\n\t\tif ((def == NULL) || (def[0] == \'\\0\'))\n\t\t\treturn(1);\n\t\tstrcpy(buf,def);\n\t\tstrcat(buf,"\\n");\n\t\t}\n\telse if ((buf[0] == \'.\') && (buf[1] == \'\\n\')) return(1);\n\ti=strlen(buf);\n\tif (buf[i-1] != \'\\n\')\n\t\t{\n\t\tBIO_printf(bio_err,"weird input :-(\\n");\n\t\treturn(0);\n\t\t}\n\tbuf[--i]=\'\\0\';\n#ifdef CHARSET_EBCDIC\n\tebcdic2ascii(buf, buf, i);\n#endif\n\tif(!req_check_len(i, n_min, n_max)) goto start;\n\tif (!X509_NAME_add_entry_by_NID(n,nid, chtype,\n\t\t\t\t(unsigned char *) buf, -1,-1,mval)) goto err;\n\tret=1;\nerr:\n\treturn(ret);\n\t}']