]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/ppd-mark.c
Fix potential unaligned accesses in the string pool (Issue #5474)
[thirdparty/cups.git] / cups / ppd-mark.c
index 464c09a98791f094defb774c9c5b2eac004c4b7f..9eca0cec7f20110738ec498ad6fdbbd90a11bea1 100644 (file)
@@ -1,18 +1,13 @@
 /*
  * Option marking routines for CUPS.
  *
- * Copyright 2007-2017 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.
  *
- * These coded instructions, statements, and computer programs are the
- * 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
- * missing or damaged, see the license at "http://www.cups.org/".
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  *
  * PostScript is a trademark of Adobe Systems, Inc.
- *
- * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
@@ -21,6 +16,7 @@
 
 #include "cups-private.h"
 #include "ppd-private.h"
+#include "debug-internal.h"
 
 
 /*
@@ -890,9 +886,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
          case PPD_CUSTOM_PASSWORD :
          case PPD_CUSTOM_STRING :
              if (cparam->current.custom_string)
-               _cupsStrFree(cparam->current.custom_string);
+               free(cparam->current.custom_string);
 
-             cparam->current.custom_string = _cupsStrAlloc(choice + 7);
+             cparam->current.custom_string = strdup(choice + 7);
              break;
        }
       }
@@ -967,9 +963,9 @@ ppd_mark_option(ppd_file_t *ppd,    /* I - PPD file */
          case PPD_CUSTOM_PASSWORD :
          case PPD_CUSTOM_STRING :
              if (cparam->current.custom_string)
-               _cupsStrFree(cparam->current.custom_string);
+               free(cparam->current.custom_string);
 
-             cparam->current.custom_string = _cupsStrRetain(val->value);
+             cparam->current.custom_string = strdup(val->value);
              break;
        }
       }