]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/cups-driverd.cxx
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / scheduler / cups-driverd.cxx
index 73f3228d5fb3ee576b2745333abf60a2037c63a3..d7d017131a0424d340b84cdafc028adc03be3c65 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * "$Id$"
- *
  * PPD/driver support for CUPS.
  *
  * This program handles listing and installing static PPD files, PPD files
@@ -14,7 +12,7 @@
  * property of Apple Inc. and are protected by Federal copyright
  * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
  * which should have been included with this file.  If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
  */
 
 /*
@@ -33,7 +31,7 @@
  * Constants...
  */
 
-#define PPD_SYNC       0x50504438      /* Sync word for ppds.dat (PPD8) */
+#define PPD_SYNC       0x50504439      /* Sync word for ppds.dat (PPD9) */
 #define PPD_MAX_LANG   32              /* Maximum languages */
 #define PPD_MAX_PROD   32              /* Maximum products */
 #define PPD_MAX_VERS   32              /* Maximum versions */
@@ -77,7 +75,7 @@ typedef struct                                /**** PPD record ****/
   int          model_number;           /* cupsModelNumber */
   int          type;                   /* ppd-type */
   char         filename[512],          /* Filename */
-               name[512],              /* PPD name */
+               name[256],              /* PPD name */
                languages[PPD_MAX_LANG][6],
                                        /* LanguageVersion/cupsLanguages */
                products[PPD_MAX_PROD][128],
@@ -448,6 +446,12 @@ cat_ppd(const char *name,          /* I - PPD name */
   * Figure out if this is a static or dynamic PPD file...
   */
 
+  if (strstr(name, "../"))
+  {
+    fputs("ERROR: Invalid PPD name.\n", stderr);
+    return (1);
+  }
+
   strlcpy(scheme, name, sizeof(scheme));
   if ((sptr = strchr(scheme, ':')) != NULL)
   {
@@ -906,7 +910,7 @@ get_file(const char *name,          /* I - Name */
        slash > printerDriver))
   {
    /*
-    * Map ppd-name to OS X standard locations...
+    * Map ppd-name to macOS standard locations...
     */
 
     snprintf(buffer, bufsize, "/%s", name);
@@ -1077,7 +1081,7 @@ list_ppds(int        request_id,  /* I - Request ID */
 
 #ifdef __APPLE__
  /*
-  * Load PPDs from standard OS X locations...
+  * Load PPDs from standard macOS locations...
   */
 
   load_ppds("/Library/Printers",
@@ -1715,7 +1719,7 @@ load_drivers(cups_array_t *include,       /* I - Drivers to include */
   char         *argv[3],               /* Arguments for command */
                filename[1024],         /* Name of driver */
                line[2048],             /* Line from driver */
-               name[512],              /* ppd-name */
+               name[256],              /* ppd-name */
                make[128],              /* ppd-make */
                make_and_model[128],    /* ppd-make-and-model */
                device_id[256],         /* ppd-device-id */
@@ -1848,7 +1852,7 @@ load_drivers(cups_array_t *include,       /* I - Drivers to include */
        psversion[0] = '\0';
        strlcpy(type_str, "postscript", sizeof(type_str));
 
-        if (sscanf(line, "\"%511[^\"]\"%127s%*[ \t]\"%127[^\"]\""
+        if (sscanf(line, "\"%255[^\"]\"%127s%*[ \t]\"%127[^\"]\""
                         "%*[ \t]\"%127[^\"]\"%*[ \t]\"%255[^\"]\""
                         "%*[ \t]\"%127[^\"]\"%*[ \t]\"%127[^\"]\""
                         "%*[ \t]\"%127[^\"]\"",
@@ -2379,7 +2383,7 @@ load_ppds(const char *d,          /* I - Actual directory */
   char         filename[1024],         /* Name of PPD or directory */
                line[256],              /* Line from file */
                *ptr,                   /* Pointer into name */
-               name[128];              /* Name of PPD file */
+               name[256];              /* Name of PPD file */
   ppd_info_t   *ppd,                   /* New PPD file */
                key;                    /* Search key */
 
@@ -2922,8 +2926,3 @@ regex_string(const char *s)               /* I - String to compare */
 
   return (NULL);
 }
-
-
-/*
- * End of "$Id$".
- */