diff --git a/tag.c b/tag.c index 8e9ceda3e..df83e7a38 100644 --- a/tag.c +++ b/tag.c @@ -67,13 +67,14 @@ applyrules(Client * c, awesome_config *awesomeconf) XClassHint ch = { 0, 0 }; char *prop; - len += a_strlen(ch.res_class) + a_strlen(ch.res_name) + a_strlen(c->name); + XGetClassHint(c->display, c->win, &ch); - prop = p_new(char, len + 1); + len = a_strlen(ch.res_class) + a_strlen(ch.res_name) + a_strlen(c->name); + + prop = p_new(char, len + 3); /* rule matching */ - XGetClassHint(c->display, c->win, &ch); - snprintf(prop, len + 1, "%s:%s:%s", + snprintf(prop, len + 3, "%s:%s:%s", ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "", c->name); for(i = 0; i < awesomeconf->nrules; i++) if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0))