summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/client.c b/client.c
index 03d158f..64da343 100644
--- a/client.c
+++ b/client.c
@@ -365,16 +365,18 @@ updatetitle(Client *c) {
365 XGetWMName(dpy, c->win, &name); 365 XGetWMName(dpy, c->win, &name);
366 if(!name.nitems) 366 if(!name.nitems)
367 return; 367 return;
368 if(name.encoding == XA_STRING) 368 if(name.encoding == XA_STRING) {
369 strncpy(c->name, (char *)name.value, sizeof c->name); 369 strncpy(c->name, (char *)name.value, sizeof c->name - 1);
370 }
370 else { 371 else {
371 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success 372 if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
372 && n > 0 && *list) 373 && n > 0 && *list)
373 { 374 {
374 strncpy(c->name, *list, sizeof c->name); 375 strncpy(c->name, *list, sizeof c->name - 1);
375 XFreeStringList(list); 376 XFreeStringList(list);
376 } 377 }
377 } 378 }
379 c->name[sizeof c->name - 1] = '\0';
378 XFree(name.value); 380 XFree(name.value);
379} 381}
380 382