]> git.wh0rd.org - fontconfig.git/commitdiff
Ignore empty <dir></dir> elements
authorKeith Packard <keithp@keithp.com>
Sun, 25 May 2008 00:14:24 +0000 (17:14 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 25 May 2008 00:14:24 +0000 (17:14 -0700)
An empty element would cause every file starting with the current
directory to be scanned, probably not what the user wanted.

src/fcxml.c

index a2cc02eae263fda248693bb18c932439123df290..90c079addb17eb8e396b9d2130862bd90e12f59f 100644 (file)
@@ -2101,7 +2101,9 @@ FcEndElement(void *userData, const XML_Char *name)
            strcat (data, "fonts");
        }
 #endif
-       if (!FcStrUsesHome (data) || FcConfigHome ())
+       if (strlen ((char *) data) == 0)
+           FcConfigMessage (parse, FcSevereWarning, "empty font directory name ignored");
+       else if (!FcStrUsesHome (data) || FcConfigHome ())
        {
            if (!FcConfigAddDir (parse->config, data))
                FcConfigMessage (parse, FcSevereError, "out of memory; cannot add directory %s", data);