parse: check before truncating strings

Don't truncate the last character of a string if it isn't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=688625
This commit is contained in:
Luis de Bethencourt 2015-03-27 17:16:03 +00:00
parent 2064a07feb
commit c565c5ecb4

View file

@ -390,7 +390,8 @@ static void gst_parse_element_set (gchar *value, GstElement *element, graph_t *g
} }
pos++; pos++;
while (g_ascii_isspace (*pos)) pos++; while (g_ascii_isspace (*pos)) pos++;
if (*pos == '"') { /* truncate a string if it is delimited with double quotes */
if (*pos == '"' && pos[strlen (pos) - 1] == '"') {
pos++; pos++;
pos[strlen (pos) - 1] = '\0'; pos[strlen (pos) - 1] = '\0';
} }