Fix tag_new() tag name
possible overflow + random memory access
This commit is contained in:
parent
c90a5743b3
commit
77e458048d
@ -508,18 +508,20 @@ tag_new(int s, char *name)
|
||||
|
||||
++conf.ntag[s];
|
||||
|
||||
/* TODO: memleak here */
|
||||
if(!name || strlen(name) == 0)
|
||||
{
|
||||
if(conf.tagnamecount)
|
||||
{
|
||||
displayedName = zmalloc(2);
|
||||
sprintf(displayedName, "[%d]", conf.ntag[s]);
|
||||
/* displayedName = zmalloc(2); */
|
||||
xasprintf(&displayedName, "[%d]", conf.ntag[s]);
|
||||
}
|
||||
else
|
||||
displayedName = conf.default_tag.name;
|
||||
}
|
||||
else
|
||||
displayedName = name;
|
||||
displayedName = xstrdup(name);
|
||||
|
||||
|
||||
Tag t = { displayedName, NULL, 0, 0,
|
||||
conf.default_tag.mwfact, conf.default_tag.nmaster,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user