monitor-config-store: Properly escape monitor spec
Makes sure that monitor specs which may be read from EDID data do not contain characters that are invalid in XML. Makes it possible to restore monitor configs of monitor models with characters such as '&' in them. To make this change not break any tests, the sample monitor configs need to be adjusted as well. Apostrophes don't strictly have to be escaped in XML text elements. However, we now do escape the elements in `<monitorspec>` specifically. Closes: <https://gitlab.gnome.org/GNOME/mutter/-/issues/1011> Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1685>
This commit is contained in:
parent
c9aa43aa7a
commit
70cdd72040
@ -1138,19 +1138,34 @@ append_monitor_spec (GString *buffer,
|
||||
MetaMonitorSpec *monitor_spec,
|
||||
const char *indentation)
|
||||
{
|
||||
char *escaped;
|
||||
|
||||
g_string_append_printf (buffer, "%s<monitorspec>\n", indentation);
|
||||
|
||||
escaped = g_markup_escape_text (monitor_spec->connector, -1);
|
||||
g_string_append_printf (buffer, "%s <connector>%s</connector>\n",
|
||||
indentation,
|
||||
monitor_spec->connector);
|
||||
escaped);
|
||||
g_free (escaped);
|
||||
|
||||
escaped = g_markup_escape_text (monitor_spec->vendor, -1);
|
||||
g_string_append_printf (buffer, "%s <vendor>%s</vendor>\n",
|
||||
indentation,
|
||||
monitor_spec->vendor);
|
||||
escaped);
|
||||
g_free (escaped);
|
||||
|
||||
escaped = g_markup_escape_text (monitor_spec->product, -1);
|
||||
g_string_append_printf (buffer, "%s <product>%s</product>\n",
|
||||
indentation,
|
||||
monitor_spec->product);
|
||||
escaped);
|
||||
g_free (escaped);
|
||||
|
||||
escaped = g_markup_escape_text (monitor_spec->serial, -1);
|
||||
g_string_append_printf (buffer, "%s <serial>%s</serial>\n",
|
||||
indentation,
|
||||
monitor_spec->serial);
|
||||
escaped);
|
||||
g_free (escaped);
|
||||
|
||||
g_string_append_printf (buffer, "%s</monitorspec>\n", indentation);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -22,7 +22,7 @@
|
||||
<disabled>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x654321</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -22,7 +22,7 @@
|
||||
<disabled>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x654321</serial>
|
||||
</monitorspec>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<configuration>
|
||||
<clone>no</clone>
|
||||
<output name="DP-1">
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
<width>800</width>
|
||||
@ -18,7 +18,7 @@
|
||||
<underscanning>no</underscanning>
|
||||
</output>
|
||||
<output name="DP-2">
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x654321</serial>
|
||||
</output>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<configuration>
|
||||
<clone>no</clone>
|
||||
<output name="DP-1">
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
<width>600</width>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<configuration>
|
||||
<clone>no</clone>
|
||||
<output name="DP-1">
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
<width>600</width>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -32,7 +32,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>eDP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>eDP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -28,7 +28,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -52,7 +52,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -76,7 +76,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>eDP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -20,7 +20,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -22,7 +22,7 @@
|
||||
<disabled>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x654321</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -25,7 +25,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -28,7 +28,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -28,7 +28,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-1</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
@ -24,7 +24,7 @@
|
||||
<monitor>
|
||||
<monitorspec>
|
||||
<connector>DP-2</connector>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<vendor>MetaProduct's Inc.</vendor>
|
||||
<product>MetaMonitor</product>
|
||||
<serial>0x123456</serial>
|
||||
</monitorspec>
|
||||
|
Loading…
Reference in New Issue
Block a user