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
This commit is contained in:
parent
82912b062b
commit
8f2a807810
17
ChangeLog
17
ChangeLog
|
@ -1,4 +1,19 @@
|
|||
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]);
|
||||
|
||||
|
|
10
src/fcxml.c
10
src/fcxml.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue