graphviz/graphviz-2.12-CVE-2014-1236...

41 lines
1.2 KiB
Diff

diff --git a/lib/agraph/scan.l b/lib/agraph/scan.l
index 4eabcdc..02eaaab 100644
--- a/lib/agraph/scan.l
+++ b/lib/agraph/scan.l
@@ -93,15 +93,26 @@ static void endstr_html(void) {
* and report this to the user.
*/
static int chkNum(void) {
- unsigned char c = (unsigned char)yytext[yyleng-1]; /* last character */
- if (!isdigit(c) && (c != '.')) { /* c is letter */
- char buf[BUFSIZ];
- sprintf(buf,"badly formed number '%s' in line %d\n",yytext,line_num);
- strcat (buf, "Splits into two name tokens");
- agerror(AGERROR_SYNTAX,buf);
- return 1;
- }
- else return 0;
+ unsigned char c = (unsigned char)yytext[yyleng-1]; /* last character */
+ if (!isdigit(c) && (c != '.')) { /* c is letter */
+ unsigned char xbuf[BUFSIZ];
+ char buf[BUFSIZ];
+ agxbuf xb;
+ char* fname;
+
+ agxbinit(&xb, BUFSIZ, xbuf);
+
+ agxbput(&xb,"syntax ambiguity - badly delimited number '");
+ agxbput(&xb,yytext);
+ sprintf(buf,"' in line %d", line_num);
+ agxbput(&xb,buf);
+ agxbput(&xb, " splits into two tokens\n");
+ agerror(AGERROR_SYNTAX,agxbuse(&xb));
+
+ agxbfree(&xb);
+ return 1;
+ }
+ else return 0;
}
/* The LETTER class below consists of ascii letters, underscore, all non-ascii