tfixed a potential security flaw - dwm - [fork] customized build of dwm, the dy… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b8bccb4ac5222a01ecd6a5f82997ea2ee3b84b8b | |
parent b6b2f584ecc0510acdf7e1df46ad397cff168335 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Thu, 10 May 2007 13:47:44 +0200 | |
fixed a potential security flaw | |
Diffstat: | |
M client.c | 8 +++++--- | |
1 file changed, 5 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -365,16 +365,18 @@ updatetitle(Client *c) { | |
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); | |
} | |