summaryrefslogtreecommitdiff
path: root/cups/ppd.c
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-01-21 13:42:27 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-01-21 13:42:27 -0500
commit4b5a6914fb5155ad0452a78e0edc205e06f614a5 (patch)
tree08c24e0346782f4d6082e3855499f3c9c58b95a3 /cups/ppd.c
parent644dca1806e5052fc8fe068fa70aec2ba7324d43 (diff)
downloadcups-4b5a6914fb5155ad0452a78e0edc205e06f614a5.tar.gz
Stop parsing the Emulators keywords in PPD files (Issue #5475)
This also eliminates a potential memory leak...
Diffstat (limited to 'cups/ppd.c')
-rw-r--r--cups/ppd.c76
1 files changed, 2 insertions, 74 deletions
diff --git a/cups/ppd.c b/cups/ppd.c
index 3d3e063e8..4560d9cfc 100644
--- a/cups/ppd.c
+++ b/cups/ppd.c
@@ -1,8 +1,8 @@
/*
* PPD file routines for CUPS.
*
- * Copyright 2007-2018 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
@@ -106,7 +106,6 @@ void
ppdClose(ppd_file_t *ppd) /* I - PPD file record */
{
int i; /* Looping var */
- ppd_emul_t *emul; /* Current emulation */
ppd_group_t *group; /* Current group */
char **font; /* Current font */
ppd_attr_t **attr; /* Current attribute */
@@ -134,21 +133,6 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
_cupsStrFree(ppd->jcl_ps);
/*
- * Free any emulations...
- */
-
- if (ppd->num_emulations > 0)
- {
- for (i = ppd->num_emulations, emul = ppd->emulations; i > 0; i --, emul ++)
- {
- _cupsStrFree(emul->start);
- _cupsStrFree(emul->stop);
- }
-
- ppd_free(ppd->emulations);
- }
-
- /*
* Free any UI groups, subgroups, and options...
*/
@@ -432,7 +416,6 @@ _ppdOpen(
_ppd_localization_t localization) /* I - Localization to load */
{
int i, j, k; /* Looping vars */
- int count; /* Temporary count */
_ppd_line_t line; /* Line buffer */
ppd_file_t *ppd; /* PPD file record */
ppd_group_t *group, /* Current group */
@@ -450,7 +433,6 @@ _ppdOpen(
/* Human-readable text from file */
*string, /* Code/text from file */
*sptr, /* Pointer into string */
- *nameptr, /* Pointer into name */
*temp, /* Temporary string pointer */
**tempfonts; /* Temporary fonts pointer */
float order; /* Order dependency number */
@@ -1192,60 +1174,6 @@ _ppdOpen(
else if (!strcmp(string, "Plus90"))
ppd->landscape = 90;
}
- else if (!strcmp(keyword, "Emulators") && string)
- {
- for (count = 1, sptr = string; sptr != NULL;)
- if ((sptr = strchr(sptr, ' ')) != NULL)
- {
- count ++;
- while (*sptr == ' ')
- sptr ++;
- }
-
- ppd->num_emulations = count;
- if ((ppd->emulations = calloc((size_t)count, sizeof(ppd_emul_t))) == NULL)
- {
- pg->ppd_status = PPD_ALLOC_ERROR;
-
- goto error;
- }
-
- for (i = 0, sptr = string; i < count; i ++)
- {
- for (nameptr = ppd->emulations[i].name;
- *sptr != '\0' && *sptr != ' ';
- sptr ++)
- if (nameptr < (ppd->emulations[i].name + sizeof(ppd->emulations[i].name) - 1))
- *nameptr++ = *sptr;
-
- *nameptr = '\0';
-
- while (*sptr == ' ')
- sptr ++;
- }
- }
- else if (!strncmp(keyword, "StartEmulator_", 14))
- {
- ppd_decode(string);
-
- for (i = 0; i < ppd->num_emulations; i ++)
- if (!strcmp(keyword + 14, ppd->emulations[i].name))
- {
- ppd->emulations[i].start = string;
- string = NULL;
- }
- }
- else if (!strncmp(keyword, "StopEmulator_", 13))
- {
- ppd_decode(string);
-
- for (i = 0; i < ppd->num_emulations; i ++)
- if (!strcmp(keyword + 13, ppd->emulations[i].name))
- {
- ppd->emulations[i].stop = string;
- string = NULL;
- }
- }
else if (!strcmp(keyword, "JobPatchFile"))
{
/*