# HG changeset patch # User Anselm R. Garbe # Date 1178797664 -7200 # Node ID e1af8e712b35f0160050f1a2ff84958cd0946eec # Parent c7b4661e8902a66011122da4d869af4913950fd3 fixed a potential security flaw diff -r c7b4661e8902 -r e1af8e712b35 client.c --- a/client.c Wed May 09 11:31:14 2007 +0200 +++ b/client.c Thu May 10 13:47:44 2007 +0200 @@ -365,16 +365,18 @@ XGetWMName(dpy, c->win, &name); if(!name.nitems) return; - if(name.encoding == XA_STRING) - strncpy(c->name, (char *)name.value, sizeof c->name); + if(name.encoding == XA_STRING) { + strncpy(c->name, (char *)name.value, sizeof c->name - 1); + } else { if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { - strncpy(c->name, *list, sizeof c->name); + strncpy(c->name, *list, sizeof c->name - 1); XFreeStringList(list); } } + c->name[sizeof c->name - 1] = '\0'; XFree(name.value); }