summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2022-01-20 13:08:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2022-01-24 10:44:31 +1000
commit9b05825e534ee4e4b2206fffcfbabbafdc69471d (patch)
tree6307d47057bec7a6248fc0ce6b7efb6c575152bf /src
parent34ef11d9c9d7c2b16eea273874e7627705e05d6c (diff)
downloadxorg-lib-libxkbcommon-9b05825e534ee4e4b2206fffcfbabbafdc69471d.tar.gz
registry: skip over invalid ISO639 or ISO3166 entries
If the XML file is somehow off, don't load entries that are against the spec.
Diffstat (limited to 'src')
-rw-r--r--src/registry.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/registry.c b/src/registry.c
index 17b6650..65c2ed1 100644
--- a/src/registry.c
+++ b/src/registry.c
@@ -808,6 +808,11 @@ parse_language_list(xmlNode *language_list, struct rxkb_layout *layout)
char *str = extract_text(node);
struct rxkb_object *parent;
+ if (!str || strlen(str) != 3) {
+ free(str);
+ continue;
+ }
+
parent = &layout->base;
code = rxkb_iso639_code_create(parent);
code->code = str;
@@ -827,6 +832,11 @@ parse_country_list(xmlNode *country_list, struct rxkb_layout *layout)
char *str = extract_text(node);
struct rxkb_object *parent;
+ if (!str || strlen(str) != 2) {
+ free(str);
+ continue;
+ }
+
parent = &layout->base;
code = rxkb_iso3166_code_create(parent);
code->code = str;