Commit 8f2a8078 authored by Patrick Lam's avatar Patrick Lam

Don't crash when fc-cat invoked with no arguments.

Fix invalid read access caused by premature free and GCC4 warnings in
    libxml2 codepath.
reviewed by: plam
reviewed by: plam
parent 82912b06
2005-10-25 Jinghua Luo <sunmoon1997@gmail.com>
2005-11-18 Frederic Crozat <fcrozat@mandriva.com>
reviewed by: plam
* fc-cat/fc-cat.c (main):
Don't crash when fc-cat invoked with no arguments.
2005-11-18 Frederic Crozat <fcrozat@mandriva.com>
reviewed by: plam
* src/fcxml.c (FcConfigSaveAttr, FcConfigParseAndLoad):
Fix invalid read access caused by premature free and
GCC4 warnings in libxml2 codepath.
2005-11-17 Jinghua Luo <sunmoon1997@gmail.com>
reviewed by: plam
* src/fccfg.c (FcConfigValues):
......
......@@ -325,6 +325,9 @@ main (int argc, char **argv)
i = 1;
#endif
if (i >= argc)
usage (argv[0]);
if (FcCacheFileRead (fs, dirs, dirname (strdup(argv[i])), argv[i]))
FcCachePrintSet (fs, dirs, argv[i]);
......
......@@ -933,7 +933,7 @@ FcConfigSaveAttr (const XML_Char **attr)
return 0;
slen = 0;
for (i = 0; attr[i]; i++)
slen += strlen (attr[i]) + 1;
slen += strlen ((char *) attr[i]) + 1;
n = i;
new = malloc ((i + 1) * sizeof (FcChar8 *) + slen);
if (!new)
......@@ -2385,9 +2385,10 @@ FcConfigParseAndLoad (FcConfig *config,
printf ("\tLoading config file %s\n", filename);
f = fopen ((char *) filename, "r");
FcStrFree (filename);
if (!f)
if (!f) {
FcStrFree (filename);
goto bail0;
}
#if ENABLE_LIBXML2
memset(&sax, 0, sizeof(sax));
......@@ -2398,10 +2399,11 @@ FcConfigParseAndLoad (FcConfig *config,
sax.endElement = FcEndElement;
sax.characters = FcCharacterData;
p = xmlCreatePushParserCtxt (&sax, &parse, NULL, 0, filename);
p = xmlCreatePushParserCtxt (&sax, &parse, NULL, 0, (const char *) filename);
#else
p = XML_ParserCreate ("UTF-8");
#endif
FcStrFree (filename);
if (!p)
goto bail1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment