From: Matthew Fernandez Date: Sat, 8 Aug 2020 00:20:50 +0000 (-0700) Subject: fix: pass format parameter into gverrorf explicitly X-Git-Tag: 2.46.0~20^2^2~126^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcf3055a6737dfe3bab7d71d8a6ffd8f17a161af;p=graphviz fix: pass format parameter into gverrorf explicitly The gverrorf function was prototyped in a way that did not align with a function pointer it was stored into. On platforms with more forgiving varargs calling conventions, everything worked out OK. However, on other platforms calling gverrorf through this function pointer would result in stack corruption. This change aligns gverrorf with the type of the function pointer in which it is stored. --- diff --git a/lib/gvpr/gvpr.c b/lib/gvpr/gvpr.c index ce8c26f0a..b31d4b977 100644 --- a/lib/gvpr/gvpr.c +++ b/lib/gvpr/gvpr.c @@ -903,15 +903,13 @@ gvexitf (Expr_t *handle, Exdisc_t *discipline, int v) } static int -gverrorf (Expr_t *handle, Exdisc_t *discipline, int level, ...) +gverrorf (Expr_t *handle, Exdisc_t *discipline, int level, const char *fmt, ...) { va_list ap; - const char *s; - va_start(ap, level); - s = va_arg(ap, char *); + va_start(ap, fmt); errorv((discipline - && handle) ? *((char **) handle) : (char *) handle, level, s, ap); + && handle) ? *((char **) handle) : (char *) handle, level, fmt, ap); va_end(ap); if (level >= ERROR_ERROR) {