samiparse: Check that the string has a non-zero length before overwriting the last...
authorSebastian Dröge <sebastian@centricular.com>
Fri, 20 Jan 2017 06:02:38 +0000 (08:02 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 20 Jan 2017 06:03:33 +0000 (08:03 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=777502

gst/subparse/samiparse.c

index 517e959..377c6d7 100644 (file)
@@ -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';
     }