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");