From: Sebastian Dröge Date: Fri, 20 Jan 2017 06:02:38 +0000 (+0200) Subject: samiparse: Check that the string has a non-zero length before overwriting the last... X-Git-Tag: 1.19.3~511^2~2399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d894c19db62ce87115317616f0a5d4482d6332c4;p=platform%2Fupstream%2Fgstreamer.git 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 --- diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c index 517e959..377c6d7 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'; }