summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-05-10 13:47:44 +0200
committerAnselm R. Garbe <arg@suckless.org>2007-05-10 13:47:44 +0200
commitb8bccb4ac5222a01ecd6a5f82997ea2ee3b84b8b (patch)
tree83c2aa1803f9a9948c2c8fd9b96bc3da91e57809 /client.c
parentapplied Maarten Maathuis recenter-patch for floating clients only requesting ... (diff)
downloaddwm-b8bccb4ac5222a01ecd6a5f82997ea2ee3b84b8b.tar.gz
dwm-b8bccb4ac5222a01ecd6a5f82997ea2ee3b84b8b.zip
fixed a potential security flaw
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