Similar to commit
99eda42, ensure the second argument to agerr() is
fixed string with no user inputs. Change applied to:
* cmd/tools/gmlscan.l - unclear if this can be exploited in practice, as
only yytext can possibly hold format string
* lib/graph/lexer.c - format string can be injected via graph file
content. Note that libgraph is deprecated as of version 2.30.0, so
this fix is more relevant for older graphviz versions.
return;
errors = 1;
sprintf(buf," %s in line %d near '%s'\n", str,line_num,yytext);
- agerr(AGWARN,buf);
+ agerr(AGWARN, "%s", buf);
}
int gmlerrors()
if (buf < p) {
c = *p;
*p = '\0';
- agerr(AGPREV, buf);
+ agerr(AGPREV, "%s", buf);
*p = c;
}
agerr(AGPREV, " >>> ");
c = *LexPtr;
*LexPtr = '\0';
- agerr(AGPREV, p);
+ agerr(AGPREV, "%s", p);
*LexPtr = c;
agerr(AGPREV, " <<< ");
- agerr(AGPREV, LexPtr);
+ agerr(AGPREV, "%s", LexPtr);
}
void agerror(char *msg)