From: Dana Jansens Date: Fri, 14 Oct 2011 21:06:05 +0000 (-0400) Subject: Strip leading/trailing whitespace when parsing colors and other strings (bug #4937) X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=f0a97aca81bc879809613acc35d7d8d8398f57e1;p=dana%2Fopenbox.git Strip leading/trailing whitespace when parsing colors and other strings (bug #4937) --- diff --git a/obrender/theme.c b/obrender/theme.c index e06706da..92cb2a27 100644 --- a/obrender/theme.c +++ b/obrender/theme.c @@ -1798,6 +1798,7 @@ static gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value) if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { + g_strstrip(retvalue.addr); *value = retvalue.addr; ret = TRUE; } @@ -1816,7 +1817,13 @@ static gboolean read_color(XrmDatabase db, const RrInstance *inst, if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) && retvalue.addr != NULL) { - RrColor *c = RrColorParse(inst, retvalue.addr); + /* strip leading/trailing whitespace, but the returned value is + inside the X db and we are not to modify it, so we must make a copy + */ + RrColor *c; + + g_strstrip(retvalue.addr); + c = RrColorParse(inst, retvalue.addr); if (c != NULL) { *value = c; ret = TRUE;