Skip to content

Commit 917f13c

Browse files
committed
Escape vendor info for the monitor/layout configuration,
don't call meta_monitor_spec_free() on a NULL pointer. Backported from: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1685 Fixes #668.
1 parent 4b19c78 commit 917f13c

30 files changed

+63
-47
lines changed

src/backends/meta-monitor-config-manager.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,11 +1521,12 @@ meta_monitor_config_manager_class_init (MetaMonitorConfigManagerClass *klass)
15211521
void
15221522
meta_monitor_config_free (MetaMonitorConfig *monitor_config)
15231523
{
1524-
meta_monitor_spec_free (monitor_config->monitor_spec);
1524+
if (monitor_config->monitor_spec)
1525+
meta_monitor_spec_free (monitor_config->monitor_spec);
15251526
g_free (monitor_config->mode_spec);
15261527
g_free (monitor_config);
15271528
}
1528-
1529+
k
15291530
void
15301531
meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor_config)
15311532
{

src/backends/meta-monitor-config-store.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,19 +1155,34 @@ append_monitor_spec (GString *buffer,
11551155
MetaMonitorSpec *monitor_spec,
11561156
const char *indentation)
11571157
{
1158+
char *escaped;
1159+
11581160
g_string_append_printf (buffer, "%s<monitorspec>\n", indentation);
1161+
1162+
escaped = g_markup_escape_text (monitor_spec->connector, -1);
11591163
g_string_append_printf (buffer, "%s <connector>%s</connector>\n",
11601164
indentation,
1161-
monitor_spec->connector);
1165+
escaped);
1166+
g_free (escaped);
1167+
1168+
escaped = g_markup_escape_text (monitor_spec->vendor, -1);
11621169
g_string_append_printf (buffer, "%s <vendor>%s</vendor>\n",
11631170
indentation,
1164-
monitor_spec->vendor);
1171+
escaped);
1172+
g_free (escaped);
1173+
1174+
escaped = g_markup_escape_text (monitor_spec->product, -1);
11651175
g_string_append_printf (buffer, "%s <product>%s</product>\n",
11661176
indentation,
1167-
monitor_spec->product);
1177+
escaped);
1178+
g_free (escaped);
1179+
1180+
escaped = g_markup_escape_text (monitor_spec->serial, -1);
11681181
g_string_append_printf (buffer, "%s <serial>%s</serial>\n",
11691182
indentation,
1170-
monitor_spec->serial);
1183+
escaped);
1184+
g_free (escaped);
1185+
11711186
g_string_append_printf (buffer, "%s</monitorspec>\n", indentation);
11721187
}
11731188

src/tests/migration/oneoff-new-finished.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<monitor>
99
<monitorspec>
1010
<connector>DP-1</connector>
11-
<vendor>MetaProduct's Inc.</vendor>
11+
<vendor>MetaProduct&apos;s Inc.</vendor>
1212
<product>MetaMonitor</product>
1313
<serial>0x123456</serial>
1414
</monitorspec>
@@ -22,7 +22,7 @@
2222
<disabled>
2323
<monitorspec>
2424
<connector>DP-2</connector>
25-
<vendor>MetaProduct's Inc.</vendor>
25+
<vendor>MetaProduct&apos;s Inc.</vendor>
2626
<product>MetaMonitor</product>
2727
<serial>0x654321</serial>
2828
</monitorspec>

src/tests/migration/oneoff-new.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<monitor>
99
<monitorspec>
1010
<connector>DP-1</connector>
11-
<vendor>MetaProduct's Inc.</vendor>
11+
<vendor>MetaProduct&apos;s Inc.</vendor>
1212
<product>MetaMonitor</product>
1313
<serial>0x123456</serial>
1414
</monitorspec>
@@ -22,7 +22,7 @@
2222
<disabled>
2323
<monitorspec>
2424
<connector>DP-2</connector>
25-
<vendor>MetaProduct's Inc.</vendor>
25+
<vendor>MetaProduct&apos;s Inc.</vendor>
2626
<product>MetaMonitor</product>
2727
<serial>0x654321</serial>
2828
</monitorspec>

src/tests/migration/oneoff-old.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<configuration>
33
<clone>no</clone>
44
<output name="DP-1">
5-
<vendor>MetaProduct's Inc.</vendor>
5+
<vendor>MetaProduct&apos;s Inc.</vendor>
66
<product>MetaMonitor</product>
77
<serial>0x123456</serial>
88
<width>800</width>
@@ -18,7 +18,7 @@
1818
<underscanning>no</underscanning>
1919
</output>
2020
<output name="DP-2">
21-
<vendor>MetaProduct's Inc.</vendor>
21+
<vendor>MetaProduct&apos;s Inc.</vendor>
2222
<product>MetaMonitor</product>
2323
<serial>0x654321</serial>
2424
</output>

src/tests/migration/rotated-new-finished.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<monitor>
1313
<monitorspec>
1414
<connector>DP-1</connector>
15-
<vendor>MetaProduct's Inc.</vendor>
15+
<vendor>MetaProduct&apos;s Inc.</vendor>
1616
<product>MetaMonitor</product>
1717
<serial>0x123456</serial>
1818
</monitorspec>

src/tests/migration/rotated-new.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<monitor>
1313
<monitorspec>
1414
<connector>DP-1</connector>
15-
<vendor>MetaProduct's Inc.</vendor>
15+
<vendor>MetaProduct&apos;s Inc.</vendor>
1616
<product>MetaMonitor</product>
1717
<serial>0x123456</serial>
1818
</monitorspec>

src/tests/migration/rotated-old.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<configuration>
33
<clone>no</clone>
44
<output name="DP-1">
5-
<vendor>MetaProduct's Inc.</vendor>
5+
<vendor>MetaProduct&apos;s Inc.</vendor>
66
<product>MetaMonitor</product>
77
<serial>0x123456</serial>
88
<width>600</width>

src/tests/migration/wiggle-new-finished.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<monitor>
1313
<monitorspec>
1414
<connector>DP-1</connector>
15-
<vendor>MetaProduct's Inc.</vendor>
15+
<vendor>MetaProduct&apos;s Inc.</vendor>
1616
<product>MetaMonitor</product>
1717
<serial>0x123456</serial>
1818
</monitorspec>

src/tests/migration/wiggle-new.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<monitor>
1313
<monitorspec>
1414
<connector>DP-1</connector>
15-
<vendor>MetaProduct's Inc.</vendor>
15+
<vendor>MetaProduct&apos;s Inc.</vendor>
1616
<product>MetaMonitor</product>
1717
<serial>0x123456</serial>
1818
</monitorspec>

0 commit comments

Comments
 (0)