summaryrefslogtreecommitdiff
path: root/extra/graphviz/yyerror1.patch
blob: 4f1faf4df446d423f80e39b55ca76ee1ff036a0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From d266bb2b4154d11c27252b56d86963aef4434750 Mon Sep 17 00:00:00 2001
From: "Emden R. Gansner" <erg@alum.mit.edu>
Date: Tue, 7 Jan 2014 10:45:36 -0500
Subject: [PATCH] Prevent possible buffer overflow in yyerror()

---
 lib/cgraph/scan.l | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l
index 3efe1d5..212967c 100644
--- a/lib/cgraph/scan.l
+++ b/lib/cgraph/scan.l
@@ -201,7 +201,8 @@ void yyerror(char *str)
 		agxbput (&xb, InputFile);
 		agxbput (&xb, ": ");
 	}
-	sprintf(buf," %s in line %d near '", str,line_num);
+	agxbput (&xb, str);
+	sprintf(buf," in line %d near '", line_num);
 	agxbput (&xb, buf);
 	agxbput (&xb, yytext);
 	agxbput (&xb,"'\n");
-- 
1.8.5.1