]> granicus.if.org Git - graphviz/commitdiff
fix: pass format parameter into gverrorf explicitly
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 8 Aug 2020 00:20:50 +0000 (17:20 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 13 Aug 2020 14:38:13 +0000 (07:38 -0700)
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.

lib/gvpr/gvpr.c

index ce8c26f0a0ce598a172953c178c73f1a88670fa1..b31d4b9776d07b44ad41282192f16bcaafa3c09d 100644 (file)
@@ -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) {