From: Michael Orlitzky Date: Sun, 20 Oct 2024 22:17:52 +0000 (-0400) Subject: src/svgtiny_css.c: fix uninitalized use in node_is_lang() X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=29e40ed74de9f729755aa45459ff4f770b5be9ca;p=libsvgtiny.git src/svgtiny_css.c: fix uninitalized use in node_is_lang() If _node_has_attribute_substring() returns an error before it has a chance to overwrite the "match" variable with true/false, then we may try to access "match" while it is uninitialized. We may as well just initialize it to false (no match) to avoid this corner case. --- diff --git a/src/svgtiny_css.c b/src/svgtiny_css.c index 4856ac3..d69fa5c 100644 --- a/src/svgtiny_css.c +++ b/src/svgtiny_css.c @@ -1796,7 +1796,10 @@ static css_error node_is_lang(void *pw, void *node, dom_exception d_err; dom_node *n; /* current node */ dom_node *p; /* parent node */ - bool match; /* retval from node_has_attribute_substring() */ + + /* retval from node_has_attribute_substring(), must be + * initialized in case that function bails early */ + bool match = false; /* Define the attribute name "lang" that we're looking for. * We only use a css_qname here because that's what the