summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ralls <jralls@ceridwen.us>2019-06-20 16:07:01 -0700
committerPhilip Withnall <withnall@endlessm.com>2019-06-24 14:28:54 +0100
commit353942c67ed24b5904a5c717003d7871bdba4fed (patch)
tree8c4c4a7d3b137b5ecd55c482b38a2b4aaee2c582
parent23a6173e4eea20ba1e4c8ff8ebed7afb9980e232 (diff)
downloadglib-353942c67ed24b5904a5c717003d7871bdba4fed.tar.gz
Avoid overrunning stack at the end of the varargs.
-rw-r--r--glib/gmarkup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
index 2d94aecaf..6ad5f6c38 100644
--- a/glib/gmarkup.c
+++ b/glib/gmarkup.c
@@ -2872,9 +2872,10 @@ g_markup_collect_attributes (const gchar *element_name,
g_assert_not_reached ();
}
- type = va_arg (ap, GMarkupCollectType);
- attr = va_arg (ap, const char *);
written++;
+ type = va_arg (ap, GMarkupCollectType);
+ if (type != G_MARKUP_COLLECT_INVALID)
+ attr = va_arg (ap, const char *);
}
va_end (ap);
@@ -2950,7 +2951,8 @@ failure:
}
type = va_arg (ap, GMarkupCollectType);
- attr = va_arg (ap, const char *);
+ if (type != G_MARKUP_COLLECT_INVALID)
+ attr = va_arg (ap, const char *);
}
va_end (ap);