From 65d00e0305424bc18f321dd1715a680c87c2371a Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Mon, 25 Sep 2017 04:43:00 +0300 Subject: [PATCH] Correct remaining string length for fill_rmlvo_from_root Fixes #2538. --- src/bindings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings.c b/src/bindings.c index 42a2b79b..c145b956 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -910,7 +910,6 @@ static int fill_rmlvo_from_root(struct xkb_rule_names *xkb_names) { int remaining = xcb_get_property_value_length(prop_reply); for (int i = 0; i < 5 && remaining > 0; i++) { const int len = strnlen(walk, remaining); - remaining -= len; switch (i) { case 0: sasprintf((char **)&(xkb_names->rules), "%.*s", len, walk); @@ -930,6 +929,7 @@ static int fill_rmlvo_from_root(struct xkb_rule_names *xkb_names) { } DLOG("component %d of _XKB_RULES_NAMES is \"%.*s\"\n", i, len, walk); walk += (len + 1); + remaining -= (len + 1); } free(atom_reply); -- 2.39.5