Blame SOURCES/graphviz-2.30.1-CVE-2014-0978-CVE-2014-1235.patch

bfa7ee
diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l
bfa7ee
index e2215d1..f41049d 100644
bfa7ee
--- a/lib/cgraph/scan.l
bfa7ee
+++ b/lib/cgraph/scan.l
bfa7ee
@@ -16,6 +16,7 @@
bfa7ee
 %{
bfa7ee
 #include <grammar.h>
bfa7ee
 #include <cghdr.h>
bfa7ee
+#include <agxbuf.h>
bfa7ee
 #include <ctype.h>
bfa7ee
 #define GRAPH_EOF_TOKEN		'@'		/* lex class must be defined below */
bfa7ee
 	/* this is a workaround for linux flex */
bfa7ee
@@ -192,13 +193,22 @@ ID		({NAME}|{NUMBER})
bfa7ee
 %%
bfa7ee
 void yyerror(char *str)
bfa7ee
 {
bfa7ee
+	unsigned char	xbuf[BUFSIZ];
bfa7ee
 	char	buf[BUFSIZ];
bfa7ee
-	if (InputFile)
bfa7ee
-		sprintf(buf,"%s:%d: %s in line %d near '%s'\n",InputFile, line_num,
bfa7ee
-			str,line_num,yytext);
bfa7ee
-	else
bfa7ee
-		sprintf(buf," %s in line %d near '%s'\n", str,line_num,yytext);
bfa7ee
-	agerr(AGWARN,buf);
bfa7ee
+	agxbuf  xb;
bfa7ee
+
bfa7ee
+	agxbinit(&xb, BUFSIZ, xbuf);
bfa7ee
+	if (InputFile) {
bfa7ee
+		agxbput (&xb, InputFile);
bfa7ee
+		agxbput (&xb, ": ");
bfa7ee
+	}
bfa7ee
+	agxbput (&xb, str);
bfa7ee
+	sprintf(buf," in line %d near '", line_num);
bfa7ee
+	agxbput (&xb, buf);
bfa7ee
+	agxbput (&xb, yytext);
bfa7ee
+	agxbput (&xb,"'\n");
bfa7ee
+	agerr(AGWARN,agxbuse(&xb));
bfa7ee
+	agxbfree(&xb;;
bfa7ee
 }
bfa7ee
 /* must be here to see flex's macro defns */
bfa7ee
 void aglexeof() { unput(GRAPH_EOF_TOKEN); }