summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-01-20 08:02:38 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-01-25 14:24:18 +0200
commitcb6cbf4d6ca4e4815322976e9e119cd492ad8c34 (patch)
tree075e9db4051c6766259b2b43cdd9779a948cbf6b
parent0b43888433d1ce2c7130fef5fe83d93e03b4a4f6 (diff)
downloadgstreamer-plugins-base-cb6cbf4d6ca4e4815322976e9e119cd492ad8c34.tar.gz
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
-rw-r--r--gst/subparse/samiparse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c
index 517e959a9..377c6d730 100644
--- a/gst/subparse/samiparse.c
+++ b/gst/subparse/samiparse.c
@@ -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';
}