swaybar: fix array indices in i3json_handle

This commit is contained in:
progandy 2015-12-24 01:21:29 +01:00
parent ac23fa5f20
commit b66c51ea2c

View file

@ -659,11 +659,11 @@ int i3json_handle(FILE *file) {
}
--i3json_state.depth;
if (i3json_state.depth == 1) {
ssize_t len = c-i3json_state.line_start+1;
char p = c[len];
c[len] = '\0';
// c[1] is valid since c[0] != '\0'
char p = c[1];
c[1] = '\0';
parse_json(i3json_state.line_start);
c[len] = p;
c[1] = p;
++handled;
i3json_state.line_start = c+1;
}