config/rcxml.c: fix crash in <touch> section

...when options are specified as elements leading to hitting the assert()
in xstrdup().

Reproduce by using this rc.xml:

```
<?xml version="1.0"?>
<labwc_config>
  <touch>
    <deviceName>foo</deviceName>
    <mapToOutput>bar</mapToOutput>
  </touch>
</labwc_config>
```

It is likely that <touch> was only tested with options as attributes.
This commit is contained in:
Johan Malm 2024-12-08 17:31:23 +00:00 committed by Consolatis
parent 5e422a0bc2
commit 79232a61c1

View file

@ -646,7 +646,14 @@ fill_touch(char *nodename, char *content)
if (!strcasecmp(nodename, "touch")) {
current_touch = znew(*current_touch);
wl_list_append(&rc.touch_configs, &current_touch->link);
} else if (!strcasecmp(nodename, "deviceName.touch")) {
return;
}
if (!content) {
return;
}
if (!strcasecmp(nodename, "deviceName.touch")) {
xstrdup_replace(current_touch->device_name, content);
} else if (!strcasecmp(nodename, "mapToOutput.touch")) {
xstrdup_replace(current_touch->output_name, content);