]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #2985 from orestisf1993/next
authorIngo Bürk <admin@airblader.de>
Mon, 25 Sep 2017 07:09:56 +0000 (09:09 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Sep 2017 07:09:56 +0000 (09:09 +0200)
Correct remaining string length for fill_rmlvo_from_root

src/bindings.c

index 42a2b79b85d279c44a35e858d278812d125d837f..c145b95602dd0b34c34a5db891a17dba30ec0c48 100644 (file)
@@ -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);