Commit d894c19d authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

samiparse: Check that the string has a non-zero length before overwriting the last byte with '\0'

https://bugzilla.gnome.org/show_bug.cgi?id=777502
parent ef55c8a6
......@@ -504,7 +504,8 @@ html_context_handle_element (HtmlContext * ctxt,
}
length = strlen (attr_value);
if (attr_value[length - 1] == '"' || attr_value[length - 1] == '\'') {
if (length > 0 && (attr_value[length - 1] == '"'
|| attr_value[length - 1] == '\'')) {
attr_value[length - 1] = '\0';
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment