parse: check before truncating strings
authorLuis de Bethencourt <luis.bg@samsung.com>
Fri, 27 Mar 2015 17:16:03 +0000 (17:16 +0000)
committerLuis de Bethencourt <luis.bg@samsung.com>
Fri, 27 Mar 2015 17:16:07 +0000 (17:16 +0000)
Don't truncate the last character of a string if it isn't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=688625

gst/parse/grammar.y

index 53ee15b..f75d9bf 100644 (file)
@@ -390,7 +390,8 @@ static void gst_parse_element_set (gchar *value, GstElement *element, graph_t *g
   }
   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[strlen (pos) - 1] = '\0';
   }