]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Move strlcat/cpy to cupsConcat/CopyString.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 8 Sep 2023 16:45:20 +0000 (12:45 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 8 Sep 2023 16:45:20 +0000 (12:45 -0400)
104 files changed:
backend/dnssd.c
backend/ieee1284.c
backend/ipp.c
backend/lpd.c
backend/network.c
backend/snmp-supplies.c
backend/snmp.c
backend/testbackend.c
backend/usb-darwin.c
backend/usb-libusb.c
berkeley/lpq.c
cgi-bin/admin.c
cgi-bin/help-index.c
cgi-bin/ipp-var.c
cgi-bin/jobs.c
cgi-bin/template.c
cgi-bin/var.c
config-scripts/cups-common.m4
configure
cups/Makefile
cups/auth.c
cups/debug.c
cups/dest-localization.c
cups/dest-options.c
cups/dest.c
cups/dir.c
cups/file.c
cups/getputfile.c
cups/globals.c
cups/http-addrlist.c
cups/http-support.c
cups/ipp-support.c
cups/ipp-vars.c
cups/ipp.c
cups/langprintf.c
cups/language.c
cups/libcups2.def
cups/notify.c
cups/ppd-attr.c
cups/ppd-cache.c
cups/ppd-conflicts.c
cups/ppd-custom.c
cups/ppd-emit.c
cups/ppd-localize.c
cups/ppd-mark.c
cups/ppd-util.c
cups/ppd.c
cups/pwg-media.c
cups/raster-interpret.c
cups/raster-stream.c
cups/sidechannel.c
cups/snmp.c
cups/snprintf.c
cups/string.c
cups/testarray.c
cups/testclient.c
cups/testi18n.c
cups/testppd.c
cups/testraster.c
cups/transcode.c
cups/usersys.c
cups/util.c
examples/ppdx.c
filter/rastertopwg.c
man/mantohtml.c
notifier/dbus.c
notifier/mailto.c
notifier/rss.c
ppdc/ppdc-catalog.cxx
ppdc/ppdc-import.cxx
ppdc/ppdc-source.cxx
ppdc/ppdc.cxx
ppdc/ppdmerge.cxx
scheduler/auth.c
scheduler/cert.c
scheduler/classes.c
scheduler/client.c
scheduler/colorman.c
scheduler/conf.c
scheduler/cups-deviced.c
scheduler/cups-driverd.cxx
scheduler/cupsfilter.c
scheduler/dirsvc.c
scheduler/filter.c
scheduler/ipp.c
scheduler/job.c
scheduler/log.c
scheduler/main.c
scheduler/mime.c
scheduler/network.c
scheduler/printers.c
scheduler/process.c
scheduler/quotas.c
scheduler/statbuf.c
scheduler/subscriptions.c
scheduler/testspeed.c
scheduler/type.c
systemv/cupstestppd.c
systemv/lpadmin.c
systemv/lpoptions.c
systemv/lpstat.c
tools/ippeveprinter.c
tools/ippfind.c
tools/ipptool.c

index 46d3d9f2f52e06a40bcc1302b9bdc8c14041688a..cc6775c38a6297627d851678c5f426dc50f8e750 100644 (file)
@@ -753,7 +753,7 @@ exec_backend(char **argv)           /* I - Command-line arguments */
   * Extract the scheme from the URI...
   */
 
-  strlcpy(scheme, resolved_uri, sizeof(scheme));
+  cupsCopyString(scheme, resolved_uri, sizeof(scheme));
   if ((ptr = strchr(scheme, ':')) != NULL)
     *ptr = '\0';
 
@@ -1043,7 +1043,7 @@ query_callback(
   make_and_model[0] = '\0';
   pdl[0]            = '\0';
 
-  strlcpy(model, "Unknown", sizeof(model));
+  cupsCopyString(model, "Unknown", sizeof(model));
 
   for (data = rdata, dataend = data + rdlen;
        data < dataend;
@@ -1096,9 +1096,9 @@ query_callback(
 
     if (!_cups_strcasecmp(key, "usb_MFG") || !_cups_strcasecmp(key, "usb_MANU") ||
        !_cups_strcasecmp(key, "usb_MANUFACTURER"))
-      strlcpy(make_and_model, value, sizeof(make_and_model));
+      cupsCopyString(make_and_model, value, sizeof(make_and_model));
     else if (!_cups_strcasecmp(key, "usb_MDL") || !_cups_strcasecmp(key, "usb_MODEL"))
-      strlcpy(model, value, sizeof(model));
+      cupsCopyString(model, value, sizeof(model));
     else if (!_cups_strcasecmp(key, "product") && !strstr(value, "Ghostscript"))
     {
       if (value[0] == '(')
@@ -1110,20 +1110,20 @@ query_callback(
        if ((ptr = value + strlen(value) - 1) > value && *ptr == ')')
          *ptr = '\0';
 
-       strlcpy(model, value + 1, sizeof(model));
+       cupsCopyString(model, value + 1, sizeof(model));
       }
       else
-       strlcpy(model, value, sizeof(model));
+       cupsCopyString(model, value, sizeof(model));
     }
     else if (!_cups_strcasecmp(key, "ty"))
     {
-      strlcpy(model, value, sizeof(model));
+      cupsCopyString(model, value, sizeof(model));
 
       if ((ptr = strchr(model, ',')) != NULL)
        *ptr = '\0';
     }
     else if (!_cups_strcasecmp(key, "pdl"))
-      strlcpy(pdl, value, sizeof(pdl));
+      cupsCopyString(pdl, value, sizeof(pdl));
     else if (!_cups_strcasecmp(key, "priority"))
       device->priority = atoi(value);
     else if ((device->type == CUPS_DEVICE_IPP ||
@@ -1180,11 +1180,11 @@ query_callback(
   {
     value[0] = '\0';
     if (strstr(pdl, "application/pdf"))
-      strlcat(value, ",PDF", sizeof(value));
+      cupsConcatString(value, ",PDF", sizeof(value));
     if (strstr(pdl, "application/postscript"))
-      strlcat(value, ",PS", sizeof(value));
+      cupsConcatString(value, ",PS", sizeof(value));
     if (strstr(pdl, "application/vnd.hp-PCL"))
-      strlcat(value, ",PCL", sizeof(value));
+      cupsConcatString(value, ",PCL", sizeof(value));
     for (ptr = strstr(pdl, "image/"); ptr; ptr = strstr(ptr, "image/"))
     {
       char *valptr = value + strlen(value);
@@ -1219,8 +1219,8 @@ query_callback(
 
   if (make_and_model[0])
   {
-    strlcat(make_and_model, " ", sizeof(make_and_model));
-    strlcat(make_and_model, model, sizeof(make_and_model));
+    cupsConcatString(make_and_model, " ", sizeof(make_and_model));
+    cupsConcatString(make_and_model, model, sizeof(make_and_model));
 
     if (!_cups_strncasecmp(make_and_model, "EPSON EPSON ", 12))
       _cups_strcpy(make_and_model, make_and_model + 6);
index 5ecf8a83474b83c99e674e0bdab9f98c5e47f9cd..93c5578d61bcf160b22b3fa3d690827d7917731a 100644 (file)
@@ -295,7 +295,7 @@ backendGetDeviceID(
     }
     else
     {
-      strlcpy(temp, make_model, sizeof(temp));
+      cupsCopyString(temp, make_model, sizeof(temp));
 
       if ((tempptr = strchr(temp, ' ')) != NULL)
         *tempptr = '\0';
@@ -436,7 +436,7 @@ backendGetMakeModel(
     * Use "Unknown" as the printer make and model...
     */
 
-    strlcpy(make_model, "Unknown", make_model_size);
+    cupsCopyString(make_model, "Unknown", make_model_size);
   }
 
   cupsFreeOptions(num_values, values);
index ca8981f5d577d709515fca58391f37bc12ca2c7b..7402fd4aa1aa0ce32517abff352d4b68d60a9111 100644 (file)
@@ -634,7 +634,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
     if (ptr)
     {
-      strlcpy(username, ptr, sizeof(username));
+      cupsCopyString(username, ptr, sizeof(username));
       cupsSetUser(ptr);
     }
 
@@ -1315,7 +1315,7 @@ main(int  argc,                           /* I - Number of command-line args */
       cupsMarkOptions(ppd, num_options, options);
 
       if ((mandatory = ppdFindAttr(ppd, "cupsMandatory", NULL)) != NULL)
-        strlcpy(mandatory_attrs, mandatory->value, sizeof(mandatory_attrs));
+        cupsCopyString(mandatory_attrs, mandatory->value, sizeof(mandatory_attrs));
     }
 
    /*
@@ -2462,7 +2462,7 @@ debug_attributes(ipp_t *ipp)              /* I - Request or response message */
     }
 
     if (!strcmp(name, "job-password"))
-      strlcpy(buffer, "---", sizeof(buffer));
+      cupsCopyString(buffer, "---", sizeof(buffer));
     else
       ippAttributeString(attr, buffer, sizeof(buffer));
 
@@ -3176,12 +3176,12 @@ report_printer_state(ipp_t *ipp)        /* I - IPP response */
       if (i)
         snprintf(valptr, sizeof(value) - (size_t)(valptr - value), " %s", ippGetString(pmja, i, NULL));
       else
-        strlcpy(value, ippGetString(pmja, i, NULL), sizeof(value));
+        cupsCopyString(value, ippGetString(pmja, i, NULL), sizeof(value));
     }
 
     if (strcmp(value, mandatory_attrs))
     {
-      strlcpy(mandatory_attrs, value, sizeof(mandatory_attrs));
+      cupsCopyString(mandatory_attrs, value, sizeof(mandatory_attrs));
       fprintf(stderr, "PPD: cupsMandatory=\"%s\"\n", value);
     }
   }
@@ -3192,7 +3192,7 @@ report_printer_state(ipp_t *ipp)  /* I - IPP response */
     char       *ptr;                   /* Pointer into message */
 
 
-    strlcpy(value, "INFO: ", sizeof(value));
+    cupsCopyString(value, "INFO: ", sizeof(value));
     for (ptr = psm->values[0].string.text, valptr = value + 6;
          *ptr && valptr < (value + sizeof(value) - 6);
         ptr ++)
index bf6e71be880095164a18a492cec914158f64004c..e42ee9c1cf754595e691988c97e199e306bc354c 100644 (file)
@@ -191,7 +191,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
     * If no username is in the device URI, then use the print job user...
     */
 
-    strlcpy(username, argv[2], sizeof(username));
+    cupsCopyString(username, argv[2], sizeof(username));
   }
 
  /*
@@ -466,7 +466,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   * Sanitize the document title...
   */
 
-  strlcpy(title, argv[3], sizeof(title));
+  cupsCopyString(title, argv[3], sizeof(title));
 
   if (sanitize_title)
   {
@@ -986,7 +986,7 @@ lpd_queue(const char      *hostname,        /* I - Host to connect to */
     }
 
     if (orighost && _cups_strcasecmp(orighost, "localhost"))
-      strlcpy(localhost, orighost, sizeof(localhost));
+      cupsCopyString(localhost, orighost, sizeof(localhost));
     else
       httpGetHostname(NULL, localhost, sizeof(localhost));
 
index f7ee2fbbe3c8e080c9e34d6d7f1e7e22e4240a21..c331a3de9c5c4007e036c8cabf72aed12af977fe 100644 (file)
@@ -181,7 +181,7 @@ backendNetworkSideCB(
            for (dataptr = data + strlen(data) + 1;
                 count > 0 && dataptr < (data + sizeof(data) - 1);
                 count --, dataptr += strlen(dataptr))
-             strlcpy(dataptr, snmp_value, sizeof(data) - (size_t)(dataptr - data));
+             cupsCopyString(dataptr, snmp_value, sizeof(data) - (size_t)(dataptr - data));
 
            fprintf(stderr, "DEBUG: Returning %s %s\n", data,
                    data + strlen(data) + 1);
@@ -326,7 +326,7 @@ backendNetworkSideCB(
            if (_cupsSNMPRead(snmp_fd, &packet, 1.0) &&
                packet.object_type == CUPS_ASN1_OCTET_STRING)
            {
-             strlcpy(data, (char *)packet.object_value.string.bytes,
+             cupsCopyString(data, (char *)packet.object_value.string.bytes,
                      sizeof(data));
              datalen = (int)strlen(data);
              status  = CUPS_SC_STATUS_OK;
@@ -338,7 +338,7 @@ backendNetworkSideCB(
 
        if ((device_id = getenv("1284DEVICEID")) != NULL)
        {
-         strlcpy(data, device_id, sizeof(data));
+         cupsCopyString(data, device_id, sizeof(data));
          datalen = (int)strlen(data);
          status  = CUPS_SC_STATUS_OK;
          break;
index 687e7ae3585f7cfb44e1ff9d524c6a75e9565d31..5768d8d73c67f4491d323951098790e07f3f66e7 100644 (file)
@@ -320,7 +320,7 @@ backendSNMPSupplies(
           supplies[i].level >= 0)
         snprintf(ptr, sizeof(value) - (size_t)(ptr - value), "%d", percent);
       else
-        strlcpy(ptr, "-1", sizeof(value) - (size_t)(ptr - value));
+        cupsCopyString(ptr, "-1", sizeof(value) - (size_t)(ptr - value));
     }
 
     fprintf(stderr, "ATTR: marker-levels=%s\n", value);
@@ -540,11 +540,11 @@ backend_init_supplies(
   if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||
       packet.object_type != CUPS_ASN1_OCTET_STRING)
   {
-    strlcpy(description, "Unknown", sizeof(description));
+    cupsCopyString(description, "Unknown", sizeof(description));
     num_supplies = 0;
   }
   else
-    strlcpy(description, (char *)packet.object_value.string.bytes,
+    cupsCopyString(description, (char *)packet.object_value.string.bytes,
             sizeof(description));
 
   fprintf(stderr, "DEBUG2: hrDeviceDesc=\"%s\"\n", description);
@@ -687,7 +687,7 @@ backend_init_supplies(
   */
 
   for (i = 0; i < num_supplies; i ++)
-    strlcpy(supplies[i].color, "none", sizeof(supplies[i].color));
+    cupsCopyString(supplies[i].color, "none", sizeof(supplies[i].color));
 
   _cupsSNMPWalk(snmp_fd, &current_addr, CUPS_SNMP_VERSION_1,
                 community, prtMarkerColorantValue,
@@ -702,7 +702,7 @@ backend_init_supplies(
     if (i)
       *ptr++ = ',';
 
-    strlcpy(ptr, supplies[i].color, sizeof(value) - (size_t)(ptr - value));
+    cupsCopyString(ptr, supplies[i].color, sizeof(value) - (size_t)(ptr - value));
   }
 
   fprintf(stderr, "ATTR: marker-colors=%s\n", value);
@@ -750,9 +750,9 @@ backend_init_supplies(
     type = supplies[i].type;
 
     if (type < CUPS_TC_other || type > CUPS_TC_covers)
-      strlcpy(ptr, "unknown", sizeof(value) - (size_t)(ptr - value));
+      cupsCopyString(ptr, "unknown", sizeof(value) - (size_t)(ptr - value));
     else
-      strlcpy(ptr, types[type - CUPS_TC_other], sizeof(value) - (size_t)(ptr - value));
+      cupsCopyString(ptr, types[type - CUPS_TC_other], sizeof(value) - (size_t)(ptr - value));
   }
 
   fprintf(stderr, "ATTR: marker-types=%s\n", value);
@@ -819,7 +819,7 @@ backend_walk_cb(cups_snmp_t *packet,        /* I - SNMP packet */
          if (!_cups_strcasecmp(colors[k][0],
                                (char *)packet->object_value.string.bytes))
          {
-           strlcpy(supplies[j].color, colors[k][1], sizeof(supplies[j].color));
+           cupsCopyString(supplies[j].color, colors[k][1], sizeof(supplies[j].color));
            break;
          }
       }
@@ -862,7 +862,7 @@ backend_walk_cb(cups_snmp_t *packet,        /* I - SNMP packet */
       case CUPS_TC_csASCII :
       case CUPS_TC_csUTF8 :
       case CUPS_TC_csUnicodeASCII :
-         strlcpy(supplies[i - 1].name,
+         cupsCopyString(supplies[i - 1].name,
                  (char *)packet->object_value.string.bytes,
                  sizeof(supplies[0].name));
           break;
index 2b3c4ae16a397c24edd5fab03d620d48ea6f8856..328b77258449070061e139f4fcec9ce8950f8949 100644 (file)
@@ -498,7 +498,7 @@ fix_make_model(
     make_model[0] = 'H';
     make_model[1] = 'P';
     make_model[2] = ' ';
-    strlcpy(make_model + 3, mmptr, (size_t)make_model_size - 3);
+    cupsCopyString(make_model + 3, mmptr, (size_t)make_model_size - 3);
   }
   else if (!_cups_strncasecmp(old_make_model, "deskjet", 7))
     snprintf(make_model, (size_t)make_model_size, "HP DeskJet%s", old_make_model + 7);
@@ -507,7 +507,7 @@ fix_make_model(
   else if (!_cups_strncasecmp(old_make_model, "stylus_pro_", 11))
     snprintf(make_model, (size_t)make_model_size, "EPSON Stylus Pro %s", old_make_model + 11);
   else
-    strlcpy(make_model, old_make_model, (size_t)make_model_size);
+    cupsCopyString(make_model, old_make_model, (size_t)make_model_size);
 
   if ((mmptr = strstr(make_model, ", Inc.,")) != NULL)
   {
@@ -721,7 +721,7 @@ probe_device(snmp_cache_t *device)  /* I - Device */
            * Insert hostname/address...
            */
 
-           strlcpy(uriptr, device->addrname, sizeof(uri) - (size_t)(uriptr - uri));
+           cupsCopyString(uriptr, device->addrname, sizeof(uri) - (size_t)(uriptr - uri));
            uriptr += strlen(uriptr);
            format += 2;
          }
@@ -1182,7 +1182,7 @@ scan_devices(int ipv4,                    /* I - SNMP IPv4 socket */
     {
       char     ifname[255];            /* Interface name */
 
-      strlcpy(ifname, address + 4, sizeof(ifname));
+      cupsCopyString(ifname, address + 4, sizeof(ifname));
       if (ifname[0])
         ifname[strlen(ifname) - 1] = '\0';
 
index 2d2b719d9a2878bb47f08d09890d967907829b03..827c9e2a93991a44674fe3dae6fdb33574d63a2f 100644 (file)
@@ -84,7 +84,7 @@ main(int  argc,                               /* I - Number of command-line args */
   if (getcwd(libpath, sizeof(libpath)) &&
       (ptr = strrchr(libpath, '/')) != NULL && !strcmp(ptr, "/backend"))
   {
-    strlcpy(ptr, "/cups", sizeof(libpath) - (size_t)(ptr - libpath));
+    cupsCopyString(ptr, "/cups", sizeof(libpath) - (size_t)(ptr - libpath));
     if (!access(libpath, 0))
     {
 #ifdef __APPLE__
@@ -152,7 +152,7 @@ main(int  argc,                             /* I - Number of command-line args */
   }
 
   if (!access(scheme, X_OK))
-    strlcpy(backend, scheme, sizeof(backend));
+    cupsCopyString(backend, scheme, sizeof(backend));
   else
   {
     if ((serverbin = getenv("CUPS_SERVERBIN")) == NULL)
index eb2abd40c9bb521b3ee1de9ca4eda3b595a5572c..8fcde45c74a41c5c83252c063a72e2caf46d3e56 100644 (file)
@@ -461,7 +461,7 @@ print_device(const char *uri,               /* I - Device URI */
       */
 
       if (driverBundlePath == NULL || !CFStringGetCString(driverBundlePath, print_buffer, sizeof(print_buffer), kCFStringEncodingUTF8))
-        strlcpy(print_buffer, "USB class driver", sizeof(print_buffer));
+        cupsCopyString(print_buffer, "USB class driver", sizeof(print_buffer));
 
       fputs("STATE: +apple-missing-usbclassdriver-error\n", stderr);
       _cupsLangPrintFilter(stderr, "ERROR",
@@ -1223,10 +1223,10 @@ static Boolean list_device_cb(io_service_t obj, printer_interface_t printerIntf,
     modelstr[0] = '/';
 
     if (make  == NULL || !CFStringGetCString(make, makestr, sizeof(makestr), kCFStringEncodingUTF8))
-      strlcpy(makestr, "Unknown", sizeof(makestr));
+      cupsCopyString(makestr, "Unknown", sizeof(makestr));
 
     if (model == NULL || !CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1, kCFStringEncodingUTF8))
-      strlcpy(modelstr + 1, "Printer", sizeof(modelstr) - 1);
+      cupsCopyString(modelstr + 1, "Printer", sizeof(modelstr) - 1);
 
     optionsstr[0] = '\0';
     if (serial != NULL && CFStringGetCString(serial, serialstr, sizeof(serialstr), kCFStringEncodingUTF8))
@@ -1235,7 +1235,7 @@ static Boolean list_device_cb(io_service_t obj, printer_interface_t printerIntf,
       snprintf(optionsstr, sizeof(optionsstr), "?location=%x", (unsigned)intfLocation);
 
     httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr);
-    strlcat(uristr, optionsstr, sizeof(uristr));
+    cupsConcatString(uristr, optionsstr, sizeof(uristr));
 
     cupsBackendReport("direct", uristr, make_modelstr, make_modelstr, idstr,
                           NULL);
@@ -2033,7 +2033,7 @@ static void parse_options(char *options,
                             value);
     }
     else if (!_cups_strcasecmp(name, "serial"))
-      strlcpy(serial, value, (size_t)serial_size);
+      cupsCopyString(serial, value, (size_t)serial_size);
     else if (!_cups_strcasecmp(name, "location") && location)
       *location = (UInt32)strtoul(value, NULL, 16);
   }
@@ -2360,7 +2360,7 @@ static void parse_pserror(char *sockBuffer,
     }
 
     /* move everything over... */
-    strlcpy(gErrorBuffer, pLineEnd, sizeof(gErrorBuffer));
+    cupsCopyString(gErrorBuffer, pLineEnd, sizeof(gErrorBuffer));
     gErrorBufferPtr = gErrorBuffer;
     pLineEnd = (char *)next_line((const char *)gErrorBuffer);
   }
index 281102fee87d240e8314267d8858d6206094ebb8..2fcb58f8426e6030ebebee51cf2dd79072cc91db 100644 (file)
@@ -1123,7 +1123,7 @@ list_cb(usb_printer_t *printer,           /* I - Printer */
   */
 
   if (backendGetMakeModel(device_id, make_model, sizeof(make_model)))
-    strlcpy(make_model, "Unknown", sizeof(make_model));
+    cupsCopyString(make_model, "Unknown", sizeof(make_model));
 
  /*
   * Report the printer...
@@ -1354,7 +1354,7 @@ make_device_uri(
              (des = cupsGetOption("DES", num_values, values)) != NULL)
       _ppdNormalizeMakeAndModel(des, tempmfg, sizeof(tempmfg));
     else
-      strlcpy(tempmfg, "Unknown", sizeof(tempmfg));
+      cupsCopyString(tempmfg, "Unknown", sizeof(tempmfg));
 
     if ((tempptr = strchr(tempmfg, ' ')) != NULL)
       *tempptr = '\0';
@@ -1644,8 +1644,8 @@ print_cb(usb_printer_t *printer,  /* I - Printer */
   * Work on copies of the URIs...
   */
 
-  strlcpy(requested_uri, (char *)data, sizeof(requested_uri));
-  strlcpy(detected_uri, device_uri, sizeof(detected_uri));
+  cupsCopyString(requested_uri, (char *)data, sizeof(requested_uri));
+  cupsCopyString(detected_uri, device_uri, sizeof(detected_uri));
 
  /*
   * libusb-discovered URIs can have an "interface" specification and this
index f7969be5147e37b9cc8adc5ce47c786ba50e76fb..4f4a0ca5cc2bc8743eda4dd90a03a241bb889ba4 100644 (file)
@@ -499,7 +499,7 @@ show_jobs(const char *command,              /* I - Command name */
       */
 
       if (jobstate == IPP_JOB_PROCESSING)
-       strlcpy(rankstr, "active", sizeof(rankstr));
+       cupsCopyString(rankstr, "active", sizeof(rankstr));
       else
       {
        /*
@@ -523,7 +523,7 @@ show_jobs(const char *command,              /* I - Command name */
          snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies,
                   jobname);
        else
-         strlcpy(namestr, jobname, sizeof(namestr));
+         cupsCopyString(namestr, jobname, sizeof(namestr));
 
         _cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]"),
                        jobuser, rankstr, jobid);
index 423f412cdc15b3f98857c25d43eebf1b09179b62..8c525638da1c6d93926f8c9bf08c69022f3a07f1 100644 (file)
@@ -718,7 +718,7 @@ do_am_printer(http_t *http,         /* I - HTTP connection */
 
       *uriptr++ = '\0';
 
-      strlcpy(make, uriptr, sizeof(make));
+      cupsCopyString(make, uriptr, sizeof(make));
 
       if ((makeptr = strchr(make, ' ')) != NULL)
         *makeptr = '\0';
@@ -727,13 +727,13 @@ do_am_printer(http_t *http,               /* I - HTTP connection */
       else if (!_cups_strncasecmp(make, "laserjet", 8) ||
                !_cups_strncasecmp(make, "deskjet", 7) ||
                !_cups_strncasecmp(make, "designjet", 9))
-        strlcpy(make, "HP", sizeof(make));
+        cupsCopyString(make, "HP", sizeof(make));
       else if (!_cups_strncasecmp(make, "phaser", 6))
-        strlcpy(make, "Xerox", sizeof(make));
+        cupsCopyString(make, "Xerox", sizeof(make));
       else if (!_cups_strncasecmp(make, "stylus", 6))
-        strlcpy(make, "Epson", sizeof(make));
+        cupsCopyString(make, "Epson", sizeof(make));
       else
-        strlcpy(make, "Generic", sizeof(make));
+        cupsCopyString(make, "Generic", sizeof(make));
 
       if (!cgiGetVariable("CURRENT_MAKE"))
         cgiSetVariable("CURRENT_MAKE", make);
@@ -782,7 +782,7 @@ do_am_printer(http_t *http,         /* I - HTTP connection */
 
     if ((attr = ippFindAttribute(oldinfo, "device-uri", IPP_TAG_URI)) != NULL)
     {
-      strlcpy(uri, attr->values[0].string.text, sizeof(uri));
+      cupsCopyString(uri, attr->values[0].string.text, sizeof(uri));
       if ((uriptr = strchr(uri, ':')) != NULL && strncmp(uriptr, "://", 3) == 0)
         *uriptr = '\0';
 
@@ -1137,7 +1137,7 @@ do_am_printer(http_t *http,               /* I - HTTP connection */
     ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info",
                  NULL, cgiGetVariable("PRINTER_INFO"));
 
-    strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri));
+    cupsCopyString(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri));
 
    /*
     * Strip make and model from URI...
@@ -1375,15 +1375,15 @@ do_config_server(http_t *http)          /* I - HTTP connection */
     */
 
     if (cgiGetVariable("KERBEROS"))
-      strlcpy(default_auth_type, "Negotiate", sizeof(default_auth_type));
+      cupsCopyString(default_auth_type, "Negotiate", sizeof(default_auth_type));
     else
     {
       val = cupsGetOption("DefaultAuthType", num_settings, settings);
 
       if (!val || !_cups_strcasecmp(val, "Negotiate"))
-        strlcpy(default_auth_type, "Basic", sizeof(default_auth_type));
+        cupsCopyString(default_auth_type, "Basic", sizeof(default_auth_type));
       else
-        strlcpy(default_auth_type, val, sizeof(default_auth_type));
+        cupsCopyString(default_auth_type, val, sizeof(default_auth_type));
     }
 
     fprintf(stderr, "DEBUG: DefaultAuthType %s\n", default_auth_type);
@@ -1718,7 +1718,7 @@ do_config_server(http_t *http)            /* I - HTTP connection */
     * well...
     */
 
-    strlcat(filename, ".default", sizeof(filename));
+    cupsConcatString(filename, ".default", sizeof(filename));
 
     if (!stat(filename, &info) && info.st_size < (1024 * 1024) &&
         (cupsd = cupsFileOpen(filename, "r")) != NULL)
@@ -3230,7 +3230,7 @@ do_set_options(http_t *http,              /* I - HTTP connection */
          * Get default option name...
          */
 
-         strlcpy(keyword, line + 8, sizeof(keyword));
+         cupsCopyString(keyword, line + 8, sizeof(keyword));
 
          for (keyptr = keyword; *keyptr; keyptr ++)
            if (*keyptr == ':' || isspace(*keyptr & 255))
@@ -3486,7 +3486,7 @@ get_option_value(
     * Not a custom choice...
     */
 
-    strlcpy(buffer, val, bufsize);
+    cupsCopyString(buffer, val, bufsize);
     return (buffer);
   }
 
index 4a10235f33748f6249a5767dc2e19e6407127da6..a1bda53b3d73bc90d1a15f66df6ca3eebcb2a52f 100644 (file)
@@ -336,7 +336,7 @@ helpLoadIndex(const char *hifile,   /* I - Index filename */
 
             *ptr++ = '\0';
 
-            strlcpy(section, sectptr, sizeof(section));
+            cupsCopyString(section, sectptr, sizeof(section));
 
            while (isspace(*ptr & 255))
               ptr ++;
@@ -771,7 +771,7 @@ help_load_directory(
     if (relative)
       snprintf(relname, sizeof(relname), "%s/%s", relative, dent->filename);
     else
-      strlcpy(relname, dent->filename, sizeof(relname));
+      cupsCopyString(relname, dent->filename, sizeof(relname));
 
    /*
     * Check if we have a HTML file...
@@ -860,7 +860,7 @@ help_load_file(
   node   = NULL;
   offset = 0;
 
-  strlcpy(section, "Other", sizeof(section));
+  cupsCopyString(section, "Other", sizeof(section));
 
   while (cupsFileGets(fp, line, sizeof(line)))
   {
@@ -876,7 +876,7 @@ help_load_file(
 
       for (ptr += 13; isspace(*ptr & 255); ptr ++);
 
-      strlcpy(section, ptr, sizeof(section));
+      cupsCopyString(section, ptr, sizeof(section));
       if ((ptr = strstr(section, "-->")) != NULL)
       {
        /*
index 956eaca4ef9c967bdc473a7a27727a6509b1a4e8..f6d88af4bdf67c27e1c1461f75e2cc9718e7e708 100644 (file)
@@ -108,7 +108,7 @@ cgiGetAttributes(ipp_t      *request,       /* I - IPP request */
       *nameptr = '\0';
 
       if (!strncmp(name, "printer_state_history", 21))
-        strlcpy(name, "printer_state_history", sizeof(name));
+        cupsCopyString(name, "printer_state_history", sizeof(name));
 
      /*
       * Possibly add it to the list of attributes...
@@ -326,7 +326,7 @@ cgiMoveJobs(http_t     *http,               /* I - Connection to server */
          * Pull the name from the URI...
          */
 
-         strlcpy(current_dest, strrchr(attr->values[0].string.text, '/') + 1,
+         cupsCopyString(current_dest, strrchr(attr->values[0].string.text, '/') + 1,
                  sizeof(current_dest));
           dest = current_dest;
        }
@@ -854,7 +854,7 @@ cgiRewriteURL(const char *uri,              /* I - Current URI */
       * Force the specified resource name instead of the one in the URL...
       */
 
-      strlcpy(resource, newresource, sizeof(resource));
+      cupsCopyString(resource, newresource, sizeof(resource));
     }
     else
     {
@@ -896,7 +896,7 @@ cgiRewriteURL(const char *uri,              /* I - Current URI */
       * Make URI relative to the current server...
       */
 
-      strlcpy(url, resource, (size_t)urlsize);
+      cupsCopyString(url, resource, (size_t)urlsize);
     }
     else
     {
@@ -911,7 +911,7 @@ cgiRewriteURL(const char *uri,              /* I - Current URI */
     }
   }
   else
-    strlcpy(url, uri, (size_t)urlsize);
+    cupsCopyString(url, uri, (size_t)urlsize);
 
   return (url);
 }
@@ -1016,31 +1016,31 @@ cgiSetIPPObjectVars(
         remaining = sizeof(value) - (size_t)(valptr - value);
 
         if (!strcmp(attr->values[i].string.text, "printer-stopped"))
-         strlcpy(valptr, _("Printer Paused"), remaining);
+         cupsCopyString(valptr, _("Printer Paused"), remaining);
        else if (!strcmp(attr->values[i].string.text, "printer-added"))
-         strlcpy(valptr, _("Printer Added"), remaining);
+         cupsCopyString(valptr, _("Printer Added"), remaining);
        else if (!strcmp(attr->values[i].string.text, "printer-modified"))
-         strlcpy(valptr, _("Printer Modified"), remaining);
+         cupsCopyString(valptr, _("Printer Modified"), remaining);
        else if (!strcmp(attr->values[i].string.text, "printer-deleted"))
-         strlcpy(valptr, _("Printer Deleted"), remaining);
+         cupsCopyString(valptr, _("Printer Deleted"), remaining);
        else if (!strcmp(attr->values[i].string.text, "job-created"))
-         strlcpy(valptr, _("Job Created"), remaining);
+         cupsCopyString(valptr, _("Job Created"), remaining);
        else if (!strcmp(attr->values[i].string.text, "job-completed"))
-         strlcpy(valptr, _("Job Completed"), remaining);
+         cupsCopyString(valptr, _("Job Completed"), remaining);
        else if (!strcmp(attr->values[i].string.text, "job-stopped"))
-         strlcpy(valptr, _("Job Stopped"), remaining);
+         cupsCopyString(valptr, _("Job Stopped"), remaining);
        else if (!strcmp(attr->values[i].string.text, "job-config-changed"))
-         strlcpy(valptr, _("Job Options Changed"), remaining);
+         cupsCopyString(valptr, _("Job Options Changed"), remaining);
        else if (!strcmp(attr->values[i].string.text, "server-restarted"))
-         strlcpy(valptr, _("Server Restarted"), remaining);
+         cupsCopyString(valptr, _("Server Restarted"), remaining);
        else if (!strcmp(attr->values[i].string.text, "server-started"))
-         strlcpy(valptr, _("Server Started"), remaining);
+         cupsCopyString(valptr, _("Server Started"), remaining);
        else if (!strcmp(attr->values[i].string.text, "server-stopped"))
-         strlcpy(valptr, _("Server Stopped"), remaining);
+         cupsCopyString(valptr, _("Server Stopped"), remaining);
        else if (!strcmp(attr->values[i].string.text, "server-audit"))
-         strlcpy(valptr, _("Server Security Auditing"), remaining);
+         cupsCopyString(valptr, _("Server Security Auditing"), remaining);
        else
-          strlcpy(valptr, attr->values[i].string.text, remaining);
+          cupsCopyString(valptr, attr->values[i].string.text, remaining);
 
         valptr += strlen(valptr);
       }
@@ -1101,7 +1101,7 @@ cgiSetIPPObjectVars(
 
          httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "http",
                          userpass, host, port, resource);
-          strlcpy(name, uri, sizeof(name));
+          cupsCopyString(name, uri, sizeof(name));
        }
        else
        {
@@ -1110,7 +1110,7 @@ cgiSetIPPObjectVars(
          */
 
          snprintf(uri, sizeof(uri), "/rss%s", resource);
-          strlcpy(name, resource + 1, sizeof(name));
+          cupsCopyString(name, resource + 1, sizeof(name));
        }
       }
       else
@@ -1119,8 +1119,8 @@ cgiSetIPPObjectVars(
         * Other...
        */
 
-        strlcpy(uri, attr->values[0].string.text, sizeof(uri));
-       strlcpy(name, resource, sizeof(name));
+        cupsCopyString(uri, attr->values[0].string.text, sizeof(uri));
+       cupsCopyString(name, resource, sizeof(name));
       }
 
       cgiSetArray("notify_recipient_uri", element, uri);
@@ -1151,7 +1151,7 @@ cgiSetIPPObjectVars(
     for (i = 0; i < attr->num_values; i ++)
     {
       if (i)
-       strlcat(valptr, ", ", sizeof(value) - (size_t)(valptr - value));
+       cupsConcatString(valptr, ", ", sizeof(value) - (size_t)(valptr - value));
 
       valptr += strlen(valptr);
 
@@ -1171,7 +1171,7 @@ cgiSetIPPObjectVars(
            break;
 
        case IPP_TAG_NOVALUE :
-           strlcat(valptr, "novalue", sizeof(value) - (size_t)(valptr - value));
+           cupsConcatString(valptr, "novalue", sizeof(value) - (size_t)(valptr - value));
            break;
 
        case IPP_TAG_RANGE :
@@ -1207,7 +1207,7 @@ cgiSetIPPObjectVars(
        case IPP_TAG_CHARSET :
        case IPP_TAG_LANGUAGE :
        case IPP_TAG_MIMETYPE :
-           strlcat(valptr, attr->values[i].string.text,
+           cupsConcatString(valptr, attr->values[i].string.text,
                    sizeof(value) - (size_t)(valptr - value));
            break;
 
@@ -1460,7 +1460,7 @@ cgiShowJobs(http_t     *http,             /* I - Connection to server */
       cgiSetVariable("PRINTER_URI_SUPPORTED", val);
     }
     else
-      strlcpy(val, "/jobs/", sizeof(val));
+      cupsCopyString(val, "/jobs/", sizeof(val));
 
     cgiSetVariable("THISURL", val);
 
index f958b449865b749f91d71883bf8cb69dbd28b7db..8ed7583bc55ab2973b0580b28c36c9c30601856d 100644 (file)
@@ -170,7 +170,7 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
     char       url[1024];              /* Encoded URL */
 
 
-    strlcpy(url, "5;URL=", sizeof(url));
+    cupsCopyString(url, "5;URL=", sizeof(url));
     cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
     cgiSetVariable("refresh_page", url);
   }
index 33d738e9c9e3623588c15a8fdbdbe8346868f1a1..c60117cdd63333bd29e260629cc6375990f222a5 100644 (file)
@@ -93,7 +93,7 @@ cgiCopyTemplateLang(const char *tmpl) /* I - Base filename */
   if ((lang = getenv("LANG")) != NULL)
   {
     locale[0] = '/';
-    strlcpy(locale + 1, lang, sizeof(locale) - 1);
+    cupsCopyString(locale + 1, lang, sizeof(locale) - 1);
 
     if ((locptr = strchr(locale, '.')) != NULL)
       *locptr = '\0';                  /* Strip charset */
@@ -482,19 +482,19 @@ cgi_copy(FILE *out,                       /* I - Output file */
              if ((innerval = cgiGetArray(innername, atoi(innerptr) - 1)) == NULL)
                *s = '\0';
              else
-               strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
+               cupsCopyString(s, innerval, sizeof(compare) - (size_t)(s - compare));
            }
            else if (innername[0] == '?')
            {
              if ((innerval = cgiGetArray(innername + 1, element)) == NULL)
                *s = '\0';
              else
-               strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
+               cupsCopyString(s, innerval, sizeof(compare) - (size_t)(s - compare));
             }
            else if ((innerval = cgiGetArray(innername, element)) == NULL)
              snprintf(s, sizeof(compare) - (size_t)(s - compare), "{%s}", innername);
            else
-             strlcpy(s, innerval, sizeof(compare) - (size_t)(s - compare));
+             cupsCopyString(s, innerval, sizeof(compare) - (size_t)(s - compare));
 
             s += strlen(s);
          }
index ed7a98e85e60f1753d1e2de6dc5ee02d968add6b..b2bcb007206ee25ba273d10a77df79885d1fae39 100644 (file)
@@ -557,7 +557,7 @@ cgi_add_variable(const char *name,  /* I - Variable name */
 
     if ((var->values = calloc((size_t)element + 1, sizeof(char *))) == NULL)
     {
-      /* 
+      /*
        * Rollback changes
        */
 
@@ -934,7 +934,7 @@ cgi_initialize_multipart(
     {
       if ((ptr = strstr(line + 20, " name=\"")) != NULL)
       {
-        strlcpy(name, ptr + 7, sizeof(name));
+        cupsCopyString(name, ptr + 7, sizeof(name));
 
        if ((ptr = strchr(name, '\"')) != NULL)
          *ptr = '\0';
@@ -942,7 +942,7 @@ cgi_initialize_multipart(
 
       if ((ptr = strstr(line + 20, " filename=\"")) != NULL)
       {
-        strlcpy(filename, ptr + 11, sizeof(filename));
+        cupsCopyString(filename, ptr + 11, sizeof(filename));
 
        if ((ptr = strchr(filename, '\"')) != NULL)
          *ptr = '\0';
@@ -952,7 +952,7 @@ cgi_initialize_multipart(
     {
       for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
 
-      strlcpy(mimetype, ptr, sizeof(mimetype));
+      cupsCopyString(mimetype, ptr, sizeof(mimetype));
 
       for (ptr = mimetype + strlen(mimetype) - 1;
            ptr > mimetype && isspace(*ptr & 255);
index 05357225d713369ea32c0e110a0b4a4acfaa4390..12fa7de263f2d7c14804bba60635321a679ac102 100644 (file)
@@ -160,7 +160,7 @@ AC_CHECK_FUNCS([statfs statvfs])
 dnl Checks for string functions.
 dnl TODO: Remove strdup, snprintf, and vsnprintf checks since they are C99?
 AC_CHECK_FUNCS([strdup snprintf vsnprintf])
-AC_CHECK_FUNCS([strlcat strlcpy])
+AC_CHECK_FUNCS([cupsConcatString cupsCopyString])
 
 dnl Check for random number functions...
 AC_CHECK_FUNCS([random lrand48 arc4random])
index 9da1a2c2e65f1a61b3b8b21dd35828fd21ff1ab1..7dee4f14a436a35165ef0136c9019c5b25d13ce8 100755 (executable)
--- a/configure
+++ b/configure
@@ -6270,14 +6270,14 @@ then :
 
 fi
 
-ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
-if test "x$ac_cv_func_strlcat" = xyes
+ac_fn_c_check_func "$LINENO" "cupsConcatString" "ac_cv_func_cupsConcatString"
+if test "x$ac_cv_func_cupsConcatString" = xyes
 then :
   printf "%s\n" "#define HAVE_STRLCAT 1" >>confdefs.h
 
 fi
-ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy"
-if test "x$ac_cv_func_strlcpy" = xyes
+ac_fn_c_check_func "$LINENO" "cupsCopyString" "ac_cv_func_cupsCopyString"
+if test "x$ac_cv_func_cupsCopyString" = xyes
 then :
   printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h
 
index ae56d3eb11da721c8bee97ddb50fa2edc1ddf786..4c041aa67272538bc0a3e666c9be37d46af9c055 100644 (file)
@@ -412,7 +412,7 @@ libcups2.def: $(LIBOBJS) $(IMAGEOBJS) Makefile
        echo "VERSION 2.15" >>libcups2.def
        echo "EXPORTS" >>libcups2.def
        (nm $(LIBOBJS) $(IMAGEOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}'; \
-        echo __cups_strcpy; echo __cups_strlcat; echo __cups_strlcpy; \
+        echo __cups_strcpy; echo __cups_cupsConcatString; echo __cups_cupsCopyString; \
         echo __cups_snprintf; echo __cups_vsnprintf; echo __cups_gettimeofday) | \
                grep -v -E \
                    -e 'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel|SNMP' \
index 4f474af76b0d3944b214e8e93f1c74a2d5350d8b..c5f7a96adfe2f2a0a962b7c981baac22fbc4317a 100644 (file)
@@ -512,7 +512,7 @@ _cupsSetNegotiateAuthString(
       authsize         = sizeof(http->_authstring);
     }
 
-    strlcpy(http->authstring, "Negotiate ", (size_t)authsize);
+    cupsCopyString(http->authstring, "Negotiate ", (size_t)authsize);
     httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
                   (int)output_token.length);
 
@@ -862,7 +862,7 @@ cups_gss_getname(
          * Use the resolved hostname...
          */
 
-         strlcpy(http->gsshost, host->h_name, sizeof(http->gsshost));
+         cupsCopyString(http->gsshost, host->h_name, sizeof(http->gsshost));
        }
        else
        {
index 62683790d6673de3e6d95e84d79e92b08b496ed2..11dcbc05aa2184cdf9937164584505d77a86a6a9 100644 (file)
@@ -493,7 +493,7 @@ _cups_safe_vsnprintf(
 
             if (bufptr)
            {
-             strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+             cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
              bufptr += strlen(bufptr);
            }
            break;
@@ -523,7 +523,7 @@ _cups_safe_vsnprintf(
 
            if (bufptr)
            {
-             strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+             cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
              bufptr += strlen(bufptr);
            }
            break;
@@ -538,7 +538,7 @@ _cups_safe_vsnprintf(
 
            if (bufptr)
            {
-             strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+             cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
              bufptr += strlen(bufptr);
            }
            break;
index 20871277e74db8e011ef6eb5699540d7782a1a2e..5ba43e8579ca17f7502298ca2edebfcf3a86cf72 100644 (file)
@@ -180,7 +180,7 @@ cupsLocalizeDestMedia(
     if (!size->bottom && !size->left && !size->right && !size->top)
       snprintf(lstr, sizeof(lstr), _cupsLangString(lang, _("%s (Borderless)")), lsize);
     else
-      strlcpy(lstr, lsize, sizeof(lstr));
+      cupsCopyString(lstr, lsize, sizeof(lstr));
   }
   else if (!lsource)
   {
@@ -292,7 +292,7 @@ cupsLocalizeDestValue(
     pwg_media_t *media = pwgMediaForPWG(value);
     cups_size_t size;
 
-    strlcpy(size.media, value, sizeof(size.media));
+    cupsCopyString(size.media, value, sizeof(size.media));
     size.width  = media ? media->width : 0;
     size.length = media ? media->length : 0;
     size.left   = 0;
index 4ca7fb63067304b4a76f3de656b5f8f3d3fcbcef..94d9a193f86c2d4eca1795f089063b1bf57f13c0 100644 (file)
@@ -1160,11 +1160,11 @@ cupsGetDestMediaByIndex(
   }
 
   if (nsize->key)
-    strlcpy(size->media, nsize->key, sizeof(size->media));
+    cupsCopyString(size->media, nsize->key, sizeof(size->media));
   else if (nsize->size_name)
-    strlcpy(size->media, nsize->size_name, sizeof(size->media));
+    cupsCopyString(size->media, nsize->size_name, sizeof(size->media));
   else if ((pwg = pwgMediaForSize(nsize->width, nsize->length)) != NULL)
-    strlcpy(size->media, pwg->pwg, sizeof(size->media));
+    cupsCopyString(size->media, pwg->pwg, sizeof(size->media));
   else
   {
     _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
@@ -1936,18 +1936,18 @@ cups_collection_string(
         if (!ippGetBoolean(member, 0))
         {
          if (bufptr < bufend)
-           strlcpy(bufptr, "no", (size_t)(bufend - bufptr + 1));
+           cupsCopyString(bufptr, "no", (size_t)(bufend - bufptr + 1));
          bufptr += 2;
         }
 
        if (bufptr < bufend)
-         strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
+         cupsCopyString(bufptr, mname, (size_t)(bufend - bufptr + 1));
        bufptr += strlen(mname);
         continue;
       }
 
       if (bufptr < bufend)
-        strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
+        cupsCopyString(bufptr, mname, (size_t)(bufend - bufptr + 1));
       bufptr += strlen(mname);
 
       if (bufptr < bufend)
@@ -2028,7 +2028,7 @@ cups_collection_string(
                    snprintf(temp, sizeof(temp), "%04u-%02u-%02uT%02u:%02u:%02u%c%02u%02u", year, date[2], date[3], date[4], date[5], date[6], date[8], date[9], date[10]);
 
                  if (bufptr < bufend)
-                   strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
+                   cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr + 1));
 
                  bufptr += strlen(temp);
                }
@@ -2048,7 +2048,7 @@ cups_collection_string(
                     snprintf(temp, sizeof(temp), "%dx%d%s", xres, yres, units == IPP_RES_PER_INCH ? "dpi" : "dpcm");
 
                  if (bufptr < bufend)
-                   strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
+                   cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr + 1));
 
                  bufptr += strlen(temp);
                 }
@@ -2064,7 +2064,7 @@ cups_collection_string(
                  snprintf(temp, sizeof(temp), "%d-%d", lower, upper);
 
                  if (bufptr < bufend)
-                   strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
+                   cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr + 1));
 
                  bufptr += strlen(temp);
                 }
@@ -2335,7 +2335,7 @@ cups_create_defaults(
     if (!ippGetName(attr) || ippGetGroupTag(attr) != IPP_TAG_PRINTER)
       continue;
 
-    strlcpy(name, ippGetName(attr), sizeof(name));
+    cupsCopyString(name, ippGetName(attr), sizeof(name));
     if ((nameptr = name + strlen(name) - 8) <= name || strcmp(nameptr, "-default"))
       continue;
 
@@ -2544,7 +2544,7 @@ cups_create_media_db(
           * Key is just the size name...
           */
 
-          strlcpy(media_key, mdb.size_name, sizeof(media_key));
+          cupsCopyString(media_key, mdb.size_name, sizeof(media_key));
         }
 
        /*
@@ -2552,7 +2552,7 @@ cups_create_media_db(
         */
 
         if (!mdb.bottom && !mdb.left && !mdb.right && !mdb.top)
-          strlcat(media_key, "_borderless", sizeof(media_key));
+          cupsConcatString(media_key, "_borderless", sizeof(media_key));
 
         mdb.key = media_key;
       }
index 872a6a30af5c3dab3cf4708c7fb98ba3473ee55c..82cbbe0041c5412ca0183ec752231d0cb1eaf226 100644 (file)
@@ -908,7 +908,7 @@ _cupsCreateDest(const char *name,   /* I - Printer name */
   response = cupsDoRequest(http, request, "/");
 
   if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
-    strlcpy(uri, ippGetString(attr, 0, NULL), urisize);
+    cupsCopyString(uri, ippGetString(attr, 0, NULL), urisize);
   else
   {
     ippDelete(response);
@@ -1549,7 +1549,7 @@ _cupsGetDests(http_t       *http, /* I  - Connection to server or
          * Add a default option...
          */
 
-          strlcpy(optname, attr->name, sizeof(optname));
+          cupsCopyString(optname, attr->name, sizeof(optname));
          optname[ptr - attr->name] = '\0';
 
          if (_cups_strcasecmp(optname, "media") || !cupsGetOption("media", num_options, options))
@@ -2269,7 +2269,7 @@ _cupsGetUserDefault(char   *name,         /* I - Name buffer */
 
   if (env)
   {
-    strlcpy(name, env, namesize);
+    cupsCopyString(name, env, namesize);
     return (name);
   }
 
@@ -2417,7 +2417,7 @@ appleGetPaperSize(char   *name,           /* I - Paper size name buffer */
       !CFStringGetCString(defaultPaperID, name, (CFIndex)namesize, kCFStringEncodingUTF8))
     name[0] = '\0';
   else if ((pwgmedia = pwgMediaForLegacy(name)) != NULL)
-    strlcpy(name, pwgmedia->pwg, namesize);
+    cupsCopyString(name, pwgmedia->pwg, namesize);
 
   if (defaultPaperID)
     CFRelease(defaultPaperID);
@@ -3026,7 +3026,7 @@ cups_dnssd_query_cb(
     device->state     = _CUPS_DNSSD_PENDING;
     make_and_model[0] = '\0';
 
-    strlcpy(model, "Unknown", sizeof(model));
+    cupsCopyString(model, "Unknown", sizeof(model));
 
     for (txt = rdata, txtend = txt + rdlen;
         txt < txtend;
@@ -3068,10 +3068,10 @@ cups_dnssd_query_cb(
       if (!_cups_strcasecmp(key, "usb_MFG") ||
           !_cups_strcasecmp(key, "usb_MANU") ||
          !_cups_strcasecmp(key, "usb_MANUFACTURER"))
-       strlcpy(make_and_model, value, sizeof(make_and_model));
+       cupsCopyString(make_and_model, value, sizeof(make_and_model));
       else if (!_cups_strcasecmp(key, "usb_MDL") ||
                !_cups_strcasecmp(key, "usb_MODEL"))
-       strlcpy(model, value, sizeof(model));
+       cupsCopyString(model, value, sizeof(model));
       else if (!_cups_strcasecmp(key, "product") && !strstr(value, "Ghostscript"))
       {
        if (value[0] == '(')
@@ -3083,14 +3083,14 @@ cups_dnssd_query_cb(
          if ((ptr = value + strlen(value) - 1) > value && *ptr == ')')
            *ptr = '\0';
 
-         strlcpy(model, value + 1, sizeof(model));
+         cupsCopyString(model, value + 1, sizeof(model));
        }
        else
-         strlcpy(model, value, sizeof(model));
+         cupsCopyString(model, value, sizeof(model));
       }
       else if (!_cups_strcasecmp(key, "ty"))
       {
-       strlcpy(model, value, sizeof(model));
+       cupsCopyString(model, value, sizeof(model));
 
        if ((ptr = strchr(model, ',')) != NULL)
          *ptr = '\0';
@@ -3195,8 +3195,8 @@ cups_dnssd_query_cb(
 
     if (make_and_model[0])
     {
-      strlcat(make_and_model, " ", sizeof(make_and_model));
-      strlcat(make_and_model, model, sizeof(make_and_model));
+      cupsConcatString(make_and_model, " ", sizeof(make_and_model));
+      cupsConcatString(make_and_model, model, sizeof(make_and_model));
 
       device->dest.num_options = cupsAddOption("printer-make-and-model", make_and_model, device->dest.num_options, &device->dest.options);
     }
@@ -3473,14 +3473,14 @@ cups_enum_dests(
     if (dest->instance)
       snprintf(data.def_name, sizeof(data.def_name), "%s/%s", dest->name, dest->instance);
     else
-      strlcpy(data.def_name, dest->name, sizeof(data.def_name));
+      cupsCopyString(data.def_name, dest->name, sizeof(data.def_name));
   }
   else
   {
     const char *default_printer;       /* Server default printer */
 
     if ((default_printer = cupsGetDefault2(http)) != NULL)
-      strlcpy(data.def_name, default_printer, sizeof(data.def_name));
+      cupsCopyString(data.def_name, default_printer, sizeof(data.def_name));
   }
 
   if (data.def_name[0])
@@ -4092,7 +4092,7 @@ cups_get_default(const char *filename,    /* I - File to read */
     {
       if (!_cups_strcasecmp(line, "default") && value)
       {
-        strlcpy(namebuf, value, namesize);
+        cupsCopyString(namebuf, value, namesize);
 
        if ((nameptr = strchr(namebuf, ' ')) != NULL)
          *nameptr = '\0';
@@ -4328,9 +4328,9 @@ cups_make_string(
 
       case IPP_TAG_BOOLEAN :
          if (attr->values[i].boolean)
-           strlcpy(ptr, "true", (size_t)(end - ptr + 1));
+           cupsCopyString(ptr, "true", (size_t)(end - ptr + 1));
          else
-           strlcpy(ptr, "false", (size_t)(end - ptr + 1));
+           cupsCopyString(ptr, "false", (size_t)(end - ptr + 1));
          break;
 
       case IPP_TAG_RANGE :
index d807155086aa43e19846ddb5181242410df24728..328ef08dadafbd3c0aecc743aca94419ee7bca6a 100644 (file)
@@ -15,6 +15,7 @@
  * Include necessary headers...
  */
 
+#include "cups.h"
 #include "string-private.h"
 #include "debug-internal.h"
 #include "dir.h"
@@ -184,7 +185,7 @@ cupsDirRead(cups_dir_t *dp)         /* I - Directory pointer */
   * Copy the name over and convert the file information...
   */
 
-  strlcpy(dp->entry.filename, entry.cFileName, sizeof(dp->entry.filename));
+  cupsCopyString(dp->entry.filename, entry.cFileName, sizeof(dp->entry.filename));
 
   if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
     dp->entry.fileinfo.st_mode = 0755 | S_IFDIR;
@@ -325,7 +326,7 @@ cupsDirOpen(const char *directory)  /* I - Directory name */
   * Copy the directory name for later use...
   */
 
-  strlcpy(dp->directory, directory, sizeof(dp->directory));
+  cupsCopyString(dp->directory, directory, sizeof(dp->directory));
 
  /*
   * Return the new directory structure...
@@ -386,7 +387,7 @@ cupsDirRead(cups_dir_t *dp)         /* I - Directory pointer */
     * Copy the name over and get the file information...
     */
 
-    strlcpy(dp->entry.filename, entry->d_name, sizeof(dp->entry.filename));
+    cupsCopyString(dp->entry.filename, entry->d_name, sizeof(dp->entry.filename));
 
     snprintf(filename, sizeof(filename), "%s/%s", dp->directory, entry->d_name);
 
index c5956608915b6b34ef30b19a1899a209698883d5..b0e704f02e3433f8e0abb1409f8f683e325d4286 100644 (file)
@@ -176,7 +176,7 @@ _cupsFileCheck(
   * Now check the containing directory...
   */
 
-  strlcpy(temp, filename, sizeof(temp));
+  cupsCopyString(temp, filename, sizeof(temp));
   if ((ptr = strrchr(temp, '/')) != NULL)
   {
     if (ptr == temp)
@@ -536,7 +536,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
 
     if (!access(filename, 0))
     {
-      strlcpy(buffer, filename, (size_t)bufsize);
+      cupsCopyString(buffer, filename, (size_t)bufsize);
       return (buffer);
     }
     else
@@ -561,7 +561,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
       if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
         *bufptr++ = '/';
 
-      strlcpy(bufptr, filename, (size_t)(bufend - bufptr));
+      cupsCopyString(bufptr, filename, (size_t)(bufend - bufptr));
 
 #ifdef _WIN32
       if (!access(buffer, 0))
@@ -588,7 +588,7 @@ cupsFileFind(const char *filename,  /* I - File to find */
   if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend)
     *bufptr++ = '/';
 
-  strlcpy(bufptr, filename, (size_t)(bufend - bufptr));
+  cupsCopyString(bufptr, filename, (size_t)(bufend - bufptr));
 
   if (!access(buffer, 0))
   {
@@ -1119,7 +1119,7 @@ cupsFileOpen(const char *filename,        /* I - Name of file */
         break;
 
     case 's' : /* Read/write socket */
-        strlcpy(hostname, filename, sizeof(hostname));
+        cupsCopyString(hostname, filename, sizeof(hostname));
        if ((portname = strrchr(hostname, ':')) != NULL)
          *portname++ = '\0';
        else
index d681b90fcb42ca18793c6ffd017a7c7ddbe3bb5f..9a1b0b270618e3ceeb798891ca66308eb3153dca 100644 (file)
@@ -68,7 +68,7 @@ cupsGetFd(http_t     *http,           /* I - Connection to server or @code CUPS_HTTP_DEFA
   * Then send GET requests to the HTTP server...
   */
 
-  strlcpy(if_modified_since, httpGetField(http, HTTP_FIELD_IF_MODIFIED_SINCE),
+  cupsCopyString(if_modified_since, httpGetField(http, HTTP_FIELD_IF_MODIFIED_SINCE),
           sizeof(if_modified_since));
 
   do
index dab9c88a010c40dd8ecef3c6ac6f11edf899c8f9..65c8d13aeb3539a18f8f32c2fd68d9b6dae5b669 100644 (file)
@@ -226,7 +226,7 @@ cups_globals_alloc(void)
     * Open the registry...
     */
 
-    strlcpy(installdir, "C:/Program Files/cups.org", sizeof(installdir));
+    cupsCopyString(installdir, "C:/Program Files/cups.org", sizeof(installdir));
 
     if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ, &key))
     {
@@ -286,7 +286,7 @@ cups_globals_alloc(void)
     if (!strncmp(userprofile, "C:\\", 3))
       userprofile += 2;
 
-    strlcpy(homedir, userprofile, sizeof(homedir));
+    cupsCopyString(homedir, userprofile, sizeof(homedir));
     for (homeptr = homedir; *homeptr; homeptr ++)
     {
       // Convert back slashes to forward slashes
index 63fb3a358659b1db6fde16d15e3b425c4b7b4a4c..0dd7fa42a845e29a87b7b06ac1d14b89e36561e3 100644 (file)
@@ -562,7 +562,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
     {
       addr = first;
       first->addr.un.sun_family = AF_LOCAL;
-      strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
+      cupsCopyString(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
     }
   }
   else
@@ -597,7 +597,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
         * Copy the newer address format which supports link-local addresses...
        */
 
-       strlcpy(ipv6, hostname + 4, sizeof(ipv6));
+       cupsCopyString(ipv6, hostname + 4, sizeof(ipv6));
        if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
        {
           ipv6[ipv6len] = '\0';
@@ -617,7 +617,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
         * Copy the regular non-link-local IPv6 address...
        */
 
-       strlcpy(ipv6, hostname + 1, sizeof(ipv6));
+       cupsCopyString(ipv6, hostname + 1, sizeof(ipv6));
        if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
        {
           ipv6[ipv6len] = '\0';
index f626cdbd098d3d5cffdc0db415a1b813453e1bb6..d54c4a11793f7b398de8be78493052dedd5fd32f 100644 (file)
@@ -903,13 +903,13 @@ httpSeparateURI(
   if (!strncmp(uri, "//", 2))
   {
     // Workaround for HP IPP client bug...
-    strlcpy(scheme, "ipp", (size_t)schemelen);
+    cupsCopyString(scheme, "ipp", (size_t)schemelen);
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else if (*uri == '/')
   {
     // Filename...
-    strlcpy(scheme, "file", (size_t)schemelen);
+    cupsCopyString(scheme, "file", (size_t)schemelen);
     status = HTTP_URI_STATUS_MISSING_SCHEME;
   }
   else
@@ -1159,7 +1159,7 @@ _httpSetDigestAuthString(
 
   if (nonce && *nonce && strcmp(nonce, http->nonce))
   {
-    strlcpy(http->nonce, nonce, sizeof(http->nonce));
+    cupsCopyString(http->nonce, nonce, sizeof(http->nonce));
 
     if (nonce == http->nextnonce)
       http->nextnonce[0] = '\0';
@@ -1171,7 +1171,7 @@ _httpSetDigestAuthString(
     http->nonce_count ++;
   }
 
-  strlcpy(username, http->userpass, sizeof(username));
+  cupsCopyString(username, http->userpass, sizeof(username));
   if ((password = strchr(username, ':')) != NULL)
     *password++ = '\0';
   else
index d9860c2cd9948079c00331cca1e053b638ce302d..450d645c551214c4d1a8ff353e666f70275166dc 100644 (file)
@@ -699,7 +699,7 @@ ippAttributeString(
           ptr = ippEnumString(attr->name, val->integer);
 
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
+            cupsCopyString(bufptr, ptr, (size_t)(bufend - bufptr + 1));
 
           bufptr += strlen(ptr);
           break;
@@ -713,7 +713,7 @@ ippAttributeString(
 
       case IPP_TAG_BOOLEAN :
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, val->boolean ? "true" : "false", (size_t)(bufend - bufptr + 1));
+            cupsCopyString(bufptr, val->boolean ? "true" : "false", (size_t)(bufend - bufptr + 1));
 
           bufptr += val->boolean ? 4 : 5;
           break;
@@ -757,7 +757,7 @@ ippAttributeString(
                       val->date[10]);
 
             if (buffer && bufptr < bufend)
-              strlcpy(bufptr, temp, (size_t)(bufend - bufptr + 1));
+              cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr + 1));
 
             bufptr += strlen(temp);
           }
@@ -801,7 +801,7 @@ ippAttributeString(
             bufptr ++;
 
             if (buffer && bufptr < bufend)
-              strlcpy(bufptr, val->string.language, (size_t)(bufend - bufptr));
+              cupsCopyString(bufptr, val->string.language, (size_t)(bufend - bufptr));
             bufptr += strlen(val->string.language);
 
             if (buffer && bufptr < bufend)
@@ -850,7 +850,7 @@ ippAttributeString(
       default :
           ptr = ippTagString(attr->value_tag);
           if (buffer && bufptr < bufend)
-            strlcpy(bufptr, ptr, (size_t)(bufend - bufptr + 1));
+            cupsCopyString(bufptr, ptr, (size_t)(bufend - bufptr + 1));
           bufptr += strlen(ptr);
           break;
     }
index 6eb124761fcd3320132cbfad953ad17e9ffc0d9b..c85bc02435d05357e137183d64b0fee230fc048a 100644 (file)
@@ -72,7 +72,7 @@ _ippVarsExpand(_ipp_vars_t *v,                /* I - IPP variables */
       }
       else if (!strncmp(src, "$ENV[", 5))
       {
-       strlcpy(temp, src + 5, sizeof(temp));
+       cupsCopyString(temp, src + 5, sizeof(temp));
 
        for (tempptr = temp; *tempptr; tempptr ++)
          if (*tempptr == ']')
@@ -89,7 +89,7 @@ _ippVarsExpand(_ipp_vars_t *v,                /* I - IPP variables */
         if (src[1] == '{')
        {
          src += 2;
-         strlcpy(temp, src, sizeof(temp));
+         cupsCopyString(temp, src, sizeof(temp));
          if ((tempptr = strchr(temp, '}')) != NULL)
            *tempptr = '\0';
          else
@@ -97,7 +97,7 @@ _ippVarsExpand(_ipp_vars_t *v,                /* I - IPP variables */
        }
        else
        {
-         strlcpy(temp, src + 1, sizeof(temp));
+         cupsCopyString(temp, src + 1, sizeof(temp));
 
          for (tempptr = temp; *tempptr; tempptr ++)
            if (!isalnum(*tempptr & 255) && *tempptr != '-' && *tempptr != '_')
@@ -114,7 +114,7 @@ _ippVarsExpand(_ipp_vars_t *v,              /* I - IPP variables */
 
       if (value)
       {
-        strlcpy(dstptr, value, (size_t)(dstend - dstptr + 1));
+        cupsCopyString(dstptr, value, (size_t)(dstend - dstptr + 1));
        dstptr += strlen(dstptr);
       }
     }
index 0c75216970f6c7df8fee004695611c4bb39be7b0..c4019b7e531179541745d41ef7e278cf33fa5789 100644 (file)
@@ -1092,7 +1092,7 @@ ippAddStringfv(ipp_t      *ipp,           /* I - IPP message */
       s = "(null)";
 
     bytes = (ssize_t)strlen(s);
-    strlcpy(buffer, s, sizeof(buffer));
+    cupsCopyString(buffer, s, sizeof(buffer));
   }
   else
   {
@@ -1947,7 +1947,7 @@ ippFindNextAttribute(ipp_t      *ipp,     /* I - IPP message */
     * Search for child attribute...
     */
 
-    strlcpy(parent, name, sizeof(parent));
+    cupsCopyString(parent, name, sizeof(parent));
     if ((child = strchr(parent, '/')) == NULL)
     {
       DEBUG_puts("3ippFindNextAttribute: Attribute name too long.");
@@ -4316,7 +4316,7 @@ ippSetStringfv(ipp_t           *ipp,      /* I  - IPP message */
       s = "(null)";
 
     bytes = (ssize_t)strlen(s);
-    strlcpy(buffer, s, sizeof(buffer));
+    cupsCopyString(buffer, s, sizeof(buffer));
   }
   else
   {
@@ -6329,7 +6329,7 @@ ipp_lang_code(const char *locale, /* I - Locale string */
 
   if (!_cups_strcasecmp(locale, "c"))
   {
-    strlcpy(buffer, "en", bufsize);
+    cupsCopyString(buffer, "en", bufsize);
     return (buffer);
   }
   else
index bbcbb89161d4266f2bc7ae6d3cc1619cdc887373..5f954ce1439b8cc2029c815d563adbf9e4365f08 100644 (file)
@@ -69,7 +69,7 @@ _cupsLangPrintError(const char *prefix,       /* I - Non-localized message prefix */
           /* TRANSLATORS: Message is "subject: error" */
           _cupsLangString(cg->lang_default, _("%s: %s")),
           _cupsLangString(cg->lang_default, message), strerror(last_errno));
-  strlcat(buffer, "\n", sizeof(buffer));
+  cupsConcatString(buffer, "\n", sizeof(buffer));
 
  /*
   * Convert and write to stderr...
@@ -179,7 +179,7 @@ _cupsLangPrintf(FILE       *fp,             /* I - File to write to */
            _cupsLangString(cg->lang_default, message), ap);
   va_end(ap);
 
-  strlcat(buffer, "\n", sizeof(buffer));
+  cupsConcatString(buffer, "\n", sizeof(buffer));
 
  /*
   * Transcode to the destination charset...
@@ -279,14 +279,14 @@ _cupsSetLocale(char *argv[])              /* IO - Command-line arguments */
 
   if (lc_time)
   {
-    strlcpy(new_lc_time, lc_time, sizeof(new_lc_time));
+    cupsCopyString(new_lc_time, lc_time, sizeof(new_lc_time));
     if ((charset = strchr(new_lc_time, '.')) == NULL)
       charset = new_lc_time + strlen(new_lc_time);
 
-    strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (size_t)(charset - new_lc_time));
+    cupsCopyString(charset, ".UTF-8", sizeof(new_lc_time) - (size_t)(charset - new_lc_time));
   }
   else
-    strlcpy(new_lc_time, "C", sizeof(new_lc_time));
+    cupsCopyString(new_lc_time, "C", sizeof(new_lc_time));
 
   setlocale(LC_TIME, new_lc_time);
 #endif /* LC_TIME */
index 52b1348c0ebf6ec09579bd61f3c92d158e512397..f4a3b771c3b8f2413bc73d88553cb97ecf99d597 100644 (file)
@@ -181,15 +181,15 @@ _cupsAppleLanguage(const char *locale,    /* I - Locale ID */
         * Invalid locale...
         */
 
-        strlcpy(language, "en", langsize);
+        cupsCopyString(language, "en", langsize);
         break;
 
     case 2 :
-        strlcpy(language, locale, langsize);
+        cupsCopyString(language, locale, langsize);
         break;
 
     case 5 :
-        strlcpy(language, locale, langsize);
+        cupsCopyString(language, locale, langsize);
 
        if (language[2] == '-')
        {
@@ -210,7 +210,7 @@ _cupsAppleLanguage(const char *locale,      /* I - Locale ID */
        i ++)
     if (!strcmp(locale, apple_language_locale[i].locale))
     {
-      strlcpy(language, apple_language_locale[i].language, sizeof(language));
+      cupsCopyString(language, apple_language_locale[i].language, sizeof(language));
       break;
     }
 
@@ -290,7 +290,7 @@ _cupsAppleLocale(CFStringRef languageName,  /* I - Apple language ID */
           (!strncmp(locale, apple_language_locale[i].language, len) && (locale[len] == '_' || locale[len] == '-')))
       {
         DEBUG_printf("_cupsAppleLocale: Updating locale to \"%s\".", apple_language_locale[i].locale);
-       strlcpy(locale, apple_language_locale[i].locale, localesize);
+       cupsCopyString(locale, apple_language_locale[i].locale, localesize);
        break;
       }
     }
@@ -321,7 +321,7 @@ _cupsAppleLocale(CFStringRef languageName,  /* I - Apple language ID */
     locale[3] = '_';
 
   if (!strchr(locale, '.'))
-    strlcat(locale, ".UTF-8", localesize);
+    cupsConcatString(locale, ".UTF-8", localesize);
 
   DEBUG_printf("_cupsAppleLocale: Returning \"%s\".", locale);
 
@@ -505,7 +505,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
   * Set the character set to UTF-8...
   */
 
-  strlcpy(charset, "UTF8", sizeof(charset));
+  cupsCopyString(charset, "UTF8", sizeof(charset));
 
  /*
   * Apple's setlocale doesn't give us the user's localization
@@ -584,7 +584,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
 
     if (ptr)
     {
-      strlcpy(locale, ptr, sizeof(locale));
+      cupsCopyString(locale, ptr, sizeof(locale));
       language = locale;
 
      /*
@@ -640,7 +640,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
   */
 
   if (!charset[0])
-    strlcpy(charset, "UTF8", sizeof(charset));
+    cupsCopyString(charset, "UTF8", sizeof(charset));
 
  /*
   * Parse the language string passed in to a locale string. "C" is the
@@ -655,7 +655,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
 
   if (language == NULL || !language[0] ||
       !strcmp(language, "POSIX"))
-    strlcpy(langname, "C", sizeof(langname));
+    cupsCopyString(langname, "C", sizeof(langname));
   else
   {
    /*
@@ -689,9 +689,9 @@ cupsLangGet(const char *language)   /* I - Language or locale */
       */
 
       if (!strcmp(language, "zh") && !strcmp(country, "HANS"))
-        strlcpy(country, "CN", sizeof(country));
+        cupsCopyString(country, "CN", sizeof(country));
       if (!strcmp(language, "zh") && !strcmp(country, "HANT"))
-        strlcpy(country, "TW", sizeof(country));
+        cupsCopyString(country, "TW", sizeof(country));
     }
 
     if (*language == '.' && !charset[0])
@@ -713,7 +713,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
 
     if (strlen(langname) != 2 && strlen(langname) != 3)
     {
-      strlcpy(langname, "C", sizeof(langname));
+      cupsCopyString(langname, "C", sizeof(langname));
       country[0] = '\0';
       charset[0] = '\0';
     }
@@ -765,7 +765,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
   if (country[0])
     snprintf(real, sizeof(real), "%s_%s", langname, country);
   else
-    strlcpy(real, langname, sizeof(real));
+    cupsCopyString(real, langname, sizeof(real));
 
   cupsMutexLock(&lang_mutex);
 
@@ -818,7 +818,7 @@ cupsLangGet(const char *language)   /* I - Language or locale */
   */
 
   lang->used ++;
-  strlcpy(lang->language, real, sizeof(lang->language));
+  cupsCopyString(lang->language, real, sizeof(lang->language));
 
   if (encoding != CUPS_AUTO_ENCODING)
     lang->encoding = encoding;
@@ -1300,7 +1300,7 @@ appleLangDefault(void)
     if (getenv("SOFTWARE") != NULL && (lang = getenv("LANG")) != NULL)
     {
       DEBUG_printf("3appleLangDefault: Using LANG=%s", lang);
-      strlcpy(cg->language, lang, sizeof(cg->language));
+      cupsCopyString(cg->language, lang, sizeof(cg->language));
       return (cg->language);
     }
     else if ((bundle = CFBundleGetMainBundle()) != NULL &&
@@ -1323,7 +1323,7 @@ appleLangDefault(void)
 
          CFStringGetCString(cfpath, path, sizeof(path), kCFStringEncodingUTF8);
          DEBUG_printf("3appleLangDefault: Got a resource URL (\"%s\")", path);
-         strlcat(path, "Contents/Info.plist", sizeof(path));
+         cupsConcatString(path, "Contents/Info.plist", sizeof(path));
 
           if (!access(path, R_OK))
            localizationList = CFBundleCopyPreferredLocalizationsFromArray(bundleList);
@@ -1384,7 +1384,7 @@ appleLangDefault(void)
     if (!cg->language[0])
     {
       DEBUG_puts("3appleLangDefault: Defaulting to en_US.");
-      strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
+      cupsCopyString(cg->language, "en_US.UTF-8", sizeof(cg->language));
     }
   }
   else
@@ -1429,7 +1429,7 @@ appleMessageLoad(const char *locale)      /* I - Locale ID */
   if (cups_strings)
   {
     DEBUG_puts("1appleMessageLoad: Using debug CUPS_STRINGS file.");
-    strlcpy(filename, cups_strings, sizeof(filename));
+    cupsCopyString(filename, cups_strings, sizeof(filename));
   }
   else
 #endif /* DEBUG */
@@ -1460,7 +1460,7 @@ appleMessageLoad(const char *locale)      /* I - Locale ID */
 
     DEBUG_printf("1appleMessageLoad: \"%s\": %s", filename, strerror(errno));
 
-    strlcpy(baselang, locale, sizeof(baselang));
+    cupsCopyString(baselang, locale, sizeof(baselang));
     if (baselang[3] == '-' || baselang[3] == '_')
       baselang[3] = '\0';
 
@@ -1511,7 +1511,7 @@ appleMessageLoad(const char *locale)      /* I - Locale ID */
       * Drop country code, just try language...
       */
 
-      strlcpy(baselang, locale, sizeof(baselang));
+      cupsCopyString(baselang, locale, sizeof(baselang));
       if (baselang[2] == '-' || baselang[2] == '_')
         baselang[2] = '\0';
 
index eae561d4b550a509c20b4a341325569ae69563df..65afe8538dfea76285336f54922586fdd684d9f8 100644 (file)
@@ -61,8 +61,8 @@ _cups_snprintf
 _cups_strcasecmp
 _cups_strcpy
 _cups_strcpy
-_cups_strlcat
-_cups_strlcpy
+_cups_cupsConcatString
+_cups_cupsCopyString
 _cups_strncasecmp
 _cups_vsnprintf
 _httpAddrSetPort
index 590962c76fac8f675b81f440418a22989601cf44..ed0876c1c9d39e26a0a518b43547020c4c27e085 100644 (file)
@@ -134,7 +134,7 @@ cupsNotifySubject(cups_lang_t *lang,        /* I - Language data */
             state);
   }
   else if (subscribed)
-    strlcpy(buffer, subscribed->values[0].string.text, sizeof(buffer));
+    cupsCopyString(buffer, subscribed->values[0].string.text, sizeof(buffer));
   else
     return (NULL);
 
index 23756d703aff43199e74f9a1ddac0cc61eaa669a..3f758586a97cc89a59ef42e928267b8b407f8585 100644 (file)
@@ -46,7 +46,7 @@ ppdFindAttr(ppd_file_t *ppd,          /* I - PPD file data */
   */
 
   memset(&key, 0, sizeof(key));
-  strlcpy(key.name, name, sizeof(key.name));
+  cupsCopyString(key.name, name, sizeof(key.name));
 
  /*
   * Return the first matching attribute, if any...
@@ -164,7 +164,7 @@ _ppdNormalizeMakeAndModel(
 
   if (make_and_model[0] == '(')
   {
-    strlcpy(buffer, make_and_model + 1, bufsize);
+    cupsCopyString(buffer, make_and_model + 1, bufsize);
 
     if ((bufptr = strrchr(buffer, ')')) != NULL)
       *bufptr = '\0';
@@ -230,7 +230,7 @@ _ppdNormalizeMakeAndModel(
     snprintf(buffer, bufsize, "HP %s", make_and_model);
   }
   else
-    strlcpy(buffer, make_and_model, bufsize);
+    cupsCopyString(buffer, make_and_model, bufsize);
 
  /*
   * Clean up the make...
index c83f47da276561df500041d050b3a1576296f6c1..b6f5417d8dc8cf8e95687b38aaf6c10cb29636b8 100644 (file)
@@ -3218,14 +3218,14 @@ _ppdCreateFromIPP2(
   cupsFilePuts(fp, "*PCFileName: \"ippeve.ppd\"\n");
 
   if ((attr = ippFindAttribute(supported, "printer-make-and-model", IPP_TAG_TEXT)) != NULL)
-    strlcpy(make, ippGetString(attr, 0, NULL), sizeof(make));
+    cupsCopyString(make, ippGetString(attr, 0, NULL), sizeof(make));
   else
-    strlcpy(make, "Unknown Printer", sizeof(make));
+    cupsCopyString(make, "Unknown Printer", sizeof(make));
 
   if (!_cups_strncasecmp(make, "Hewlett Packard ", 16) || !_cups_strncasecmp(make, "Hewlett-Packard ", 16))
   {
     model = make + 16;
-    strlcpy(make, "HP", sizeof(make));
+    cupsCopyString(make, "HP", sizeof(make));
   }
   else if ((model = strchr(make, ' ')) != NULL)
     *model++ = '\0';
@@ -3493,17 +3493,17 @@ _ppdCreateFromIPP2(
       y_dim      = ippFindAttribute(media_size, "y-dimension", IPP_TAG_INTEGER);
 
       if (x_dim && y_dim && (pwg = pwgMediaForSize(ippGetInteger(x_dim, 0), ippGetInteger(y_dim, 0))) != NULL)
-       strlcpy(ppdname, pwg->ppd, sizeof(ppdname));
+       cupsCopyString(ppdname, pwg->ppd, sizeof(ppdname));
       else
-       strlcpy(ppdname, "Unknown", sizeof(ppdname));
+       cupsCopyString(ppdname, "Unknown", sizeof(ppdname));
     }
     else
-      strlcpy(ppdname, "Unknown", sizeof(ppdname));
+      cupsCopyString(ppdname, "Unknown", sizeof(ppdname));
   }
   else if ((pwg = pwgMediaForPWG(ippGetString(ippFindAttribute(supported, "media-default", IPP_TAG_ZERO), 0, NULL))) != NULL)
-    strlcpy(ppdname, pwg->ppd, sizeof(ppdname));
+    cupsCopyString(ppdname, pwg->ppd, sizeof(ppdname));
   else
-    strlcpy(ppdname, "Unknown", sizeof(ppdname));
+    cupsCopyString(ppdname, "Unknown", sizeof(ppdname));
 
   sizes = cupsArrayNew3((cups_array_func_t)pwg_compare_sizes, NULL, NULL, 0, (cups_acopy_func_t)pwg_copy_size, (cups_afree_func_t)free);
 
@@ -3548,7 +3548,7 @@ _ppdCreateFromIPP2(
        if (temp.bottom == 0 && temp.left == 0 && temp.right == 0 && temp.top == 0)
          snprintf(temp.media, sizeof(temp.media), "%s.Borderless", pwg->ppd);
        else
-         strlcpy(temp.media, pwg->ppd, sizeof(temp.media));
+         cupsCopyString(temp.media, pwg->ppd, sizeof(temp.media));
 
        if (!cupsArrayFind(sizes, &temp))
          cupsArrayAdd(sizes, &temp);
@@ -3649,7 +3649,7 @@ _ppdCreateFromIPP2(
        if (temp.bottom == 0 && temp.left == 0 && temp.right == 0 && temp.top == 0)
          snprintf(temp.media, sizeof(temp.media), "%s.Borderless", pwg->ppd);
        else
-         strlcpy(temp.media, pwg->ppd, sizeof(temp.media));
+         cupsCopyString(temp.media, pwg->ppd, sizeof(temp.media));
 
        if (!cupsArrayFind(sizes, &temp))
          cupsArrayAdd(sizes, &temp);
@@ -3720,7 +3720,7 @@ _ppdCreateFromIPP2(
          if (temp.bottom == 0 && temp.left == 0 && temp.right == 0 && temp.top == 0)
            snprintf(temp.media, sizeof(temp.media), "%s.Borderless", pwg->ppd);
          else
-           strlcpy(temp.media, pwg->ppd, sizeof(temp.media));
+           cupsCopyString(temp.media, pwg->ppd, sizeof(temp.media));
 
          if (!cupsArrayFind(sizes, &temp))
            cupsArrayAdd(sizes, &temp);
@@ -3924,7 +3924,7 @@ _ppdCreateFromIPP2(
   if ((attr = ippFindAttribute(ippGetCollection(defattr, 0), "media-type", IPP_TAG_ZERO)) != NULL)
     pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname));
   else
-    strlcpy(ppdname, "Unknown", sizeof(ppdname));
+    cupsCopyString(ppdname, "Unknown", sizeof(ppdname));
 
   if ((attr = ippFindAttribute(supported, "media-type-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1)
   {
@@ -4099,7 +4099,7 @@ _ppdCreateFromIPP2(
     else
     {
       xres = yres = 300;
-      strlcpy(ppdname, "300dpi", sizeof(ppdname));
+      cupsCopyString(ppdname, "300dpi", sizeof(ppdname));
     }
 
     cupsFilePrintf(fp, "*DefaultResolution: %s\n", ppdname);
@@ -4378,7 +4378,7 @@ _ppdCreateFromIPP2(
   if ((attr = ippFindAttribute(supported, "output-bin-default", IPP_TAG_ZERO)) != NULL)
     pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname));
   else
-    strlcpy(ppdname, "Unknown", sizeof(ppdname));
+    cupsCopyString(ppdname, "Unknown", sizeof(ppdname));
 
   if ((attr = ippFindAttribute(supported, "output-bin-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 0)
   {
@@ -5078,27 +5078,27 @@ _pwgInputSlotForSource(
     return (NULL);
 
   if (_cups_strcasecmp(media_source, "main"))
-    strlcpy(name, "Cassette", namesize);
+    cupsCopyString(name, "Cassette", namesize);
   else if (_cups_strcasecmp(media_source, "alternate"))
-    strlcpy(name, "Multipurpose", namesize);
+    cupsCopyString(name, "Multipurpose", namesize);
   else if (_cups_strcasecmp(media_source, "large-capacity"))
-    strlcpy(name, "LargeCapacity", namesize);
+    cupsCopyString(name, "LargeCapacity", namesize);
   else if (_cups_strcasecmp(media_source, "bottom"))
-    strlcpy(name, "Lower", namesize);
+    cupsCopyString(name, "Lower", namesize);
   else if (_cups_strcasecmp(media_source, "middle"))
-    strlcpy(name, "Middle", namesize);
+    cupsCopyString(name, "Middle", namesize);
   else if (_cups_strcasecmp(media_source, "top"))
-    strlcpy(name, "Upper", namesize);
+    cupsCopyString(name, "Upper", namesize);
   else if (_cups_strcasecmp(media_source, "rear"))
-    strlcpy(name, "Rear", namesize);
+    cupsCopyString(name, "Rear", namesize);
   else if (_cups_strcasecmp(media_source, "side"))
-    strlcpy(name, "Side", namesize);
+    cupsCopyString(name, "Side", namesize);
   else if (_cups_strcasecmp(media_source, "envelope"))
-    strlcpy(name, "Envelope", namesize);
+    cupsCopyString(name, "Envelope", namesize);
   else if (_cups_strcasecmp(media_source, "main-roll"))
-    strlcpy(name, "Roll", namesize);
+    cupsCopyString(name, "Roll", namesize);
   else if (_cups_strcasecmp(media_source, "alternate-roll"))
-    strlcpy(name, "Roll2", namesize);
+    cupsCopyString(name, "Roll2", namesize);
   else
     pwg_ppdize_name(media_source, name, namesize);
 
@@ -5125,29 +5125,29 @@ _pwgMediaTypeForType(
     return (NULL);
 
   if (_cups_strcasecmp(media_type, "auto"))
-    strlcpy(name, "Auto", namesize);
+    cupsCopyString(name, "Auto", namesize);
   else if (_cups_strcasecmp(media_type, "cardstock"))
-    strlcpy(name, "Cardstock", namesize);
+    cupsCopyString(name, "Cardstock", namesize);
   else if (_cups_strcasecmp(media_type, "envelope"))
-    strlcpy(name, "Envelope", namesize);
+    cupsCopyString(name, "Envelope", namesize);
   else if (_cups_strcasecmp(media_type, "photographic-glossy"))
-    strlcpy(name, "Glossy", namesize);
+    cupsCopyString(name, "Glossy", namesize);
   else if (_cups_strcasecmp(media_type, "photographic-high-gloss"))
-    strlcpy(name, "HighGloss", namesize);
+    cupsCopyString(name, "HighGloss", namesize);
   else if (_cups_strcasecmp(media_type, "photographic-matte"))
-    strlcpy(name, "Matte", namesize);
+    cupsCopyString(name, "Matte", namesize);
   else if (_cups_strcasecmp(media_type, "stationery"))
-    strlcpy(name, "Plain", namesize);
+    cupsCopyString(name, "Plain", namesize);
   else if (_cups_strcasecmp(media_type, "stationery-coated"))
-    strlcpy(name, "Coated", namesize);
+    cupsCopyString(name, "Coated", namesize);
   else if (_cups_strcasecmp(media_type, "stationery-inkjet"))
-    strlcpy(name, "Inkjet", namesize);
+    cupsCopyString(name, "Inkjet", namesize);
   else if (_cups_strcasecmp(media_type, "stationery-letterhead"))
-    strlcpy(name, "Letterhead", namesize);
+    cupsCopyString(name, "Letterhead", namesize);
   else if (_cups_strcasecmp(media_type, "stationery-preprinted"))
-    strlcpy(name, "Preprinted", namesize);
+    cupsCopyString(name, "Preprinted", namesize);
   else if (_cups_strcasecmp(media_type, "transparency"))
-    strlcpy(name, "Transparency", namesize);
+    cupsCopyString(name, "Transparency", namesize);
   else
     pwg_ppdize_name(media_type, name, namesize);
 
@@ -5186,7 +5186,7 @@ _pwgPageSizeForMedia(
     * Use a standard Adobe name...
     */
 
-    strlcpy(name, media->ppd, namesize);
+    cupsCopyString(name, media->ppd, namesize);
   }
   else if (!media->pwg || !strncmp(media->pwg, "custom_", 7) ||
            (sizeptr = strchr(media->pwg, '_')) == NULL ||
@@ -5490,7 +5490,7 @@ pwg_unppdize_name(const char *ppd,        /* I - PPD keyword */
 
     if (!*ppdptr)
     {
-      strlcpy(name, ppd, namesize);
+      cupsCopyString(name, ppd, namesize);
       return;
     }
   }
index 0d73540bec3d5d98a05a224de568ae2c2d15d589..2dfdd6f50d879a71a70bd1583052bceb0869f369 100644 (file)
@@ -869,7 +869,7 @@ ppd_load_constraints(ppd_file_t *ppd)       /* I - PPD file */
     consts->num_constraints = i;
     consts->constraints     = constptr;
 
-    strlcpy(consts->resolver, constattr->spec, sizeof(consts->resolver));
+    cupsCopyString(consts->resolver, constattr->spec, sizeof(consts->resolver));
 
     for (i = 0, vptr = strchr(constattr->value, '*');
         vptr;
@@ -902,7 +902,7 @@ ppd_load_constraints(ppd_file_t *ppd)       /* I - PPD file */
       if (!_cups_strncasecmp(option, "Custom", 6) && !_cups_strcasecmp(choice, "True"))
       {
        _cups_strcpy(option, option + 6);
-       strlcpy(choice, "Custom", sizeof(choice));
+       cupsCopyString(choice, "Custom", sizeof(choice));
       }
 
       constptr->option      = ppdFindOption(ppd, option);
index 8cdd7c8220bcfcb74c2c4ae9e658a4896b09e4c6..ed9dfbb23e120e7ff04247c4e55b0607fba0f1c2 100644 (file)
@@ -35,7 +35,7 @@ ppdFindCustomOption(ppd_file_t *ppd,  /* I - PPD file */
   if (!ppd)
     return (NULL);
 
-  strlcpy(key.keyword, keyword, sizeof(key.keyword));
+  cupsCopyString(key.keyword, keyword, sizeof(key.keyword));
   return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
 }
 
index 02aefc58696d49a89eed718b40f738c1917909b1..b870014ea58b34d46f7bcb46f195d9bc493b7708 100644 (file)
@@ -477,7 +477,7 @@ ppdEmitJCL(ppd_file_t *ppd,         /* I - PPD file record */
     * question marks so that the title does not cause a PJL syntax error.
     */
 
-    strlcpy(temp, title, sizeof(temp));
+    cupsCopyString(temp, title, sizeof(temp));
 
     for (ptr = temp; *ptr; ptr ++)
       if (*ptr == '\"')
@@ -514,7 +514,7 @@ ppdEmitJCL(ppd_file_t *ppd,         /* I - PPD file record */
     * question marks so that the user does not cause a PJL syntax error.
     */
 
-    strlcpy(temp, user, sizeof(temp));
+    cupsCopyString(temp, user, sizeof(temp));
 
     for (ptr = temp; *ptr; ptr ++)
       if (*ptr == '\"')
@@ -830,7 +830,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
                  case PPD_CUSTOM_STRING :
                      if (cparam->current.custom_string)
                      {
-                       strlcpy(bufptr, cparam->current.custom_string, (size_t)(bufend - bufptr));
+                       cupsCopyString(bufptr, cparam->current.custom_string, (size_t)(bufend - bufptr));
                        bufptr += strlen(bufptr);
                      }
                      break;
@@ -850,7 +850,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
         * Otherwise just copy the option code directly...
        */
 
-        strlcpy(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
+        cupsCopyString(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
         bufptr += strlen(bufptr);
       }
     }
@@ -861,7 +861,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
       * options...
       */
 
-      strlcpy(bufptr, "[{\n", (size_t)(bufend - bufptr + 1));
+      cupsCopyString(bufptr, "[{\n", (size_t)(bufend - bufptr + 1));
       bufptr += 3;
 
      /*
@@ -885,7 +885,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
        float           values[5];      /* Values for custom command */
 
 
-        strlcpy(bufptr, "%%BeginFeature: *CustomPageSize True\n", (size_t)(bufend - bufptr + 1));
+        cupsCopyString(bufptr, "%%BeginFeature: *CustomPageSize True\n", (size_t)(bufend - bufptr + 1));
         bufptr += 37;
 
         size = ppdPageSize(ppd, "Custom");
@@ -980,7 +980,7 @@ ppdEmitString(ppd_file_t    *ppd,   /* I - PPD file record */
          * Level 2 command sequence...
          */
 
-         strlcpy(bufptr, ppd_custom_code, (size_t)(bufend - bufptr + 1));
+         cupsCopyString(bufptr, ppd_custom_code, (size_t)(bufend - bufptr + 1));
           bufptr += strlen(bufptr);
        }
       }
@@ -1072,7 +1072,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
          *bufptr++ = '\n';
       }
 
-      strlcpy(bufptr, "%%EndFeature\n"
+      cupsCopyString(bufptr, "%%EndFeature\n"
                      "} stopped cleartomark\n", (size_t)(bufend - bufptr + 1));
       bufptr += strlen(bufptr);
 
@@ -1080,7 +1080,7 @@ ppdEmitString(ppd_file_t    *ppd, /* I - PPD file record */
     }
     else if (choices[i]->code)
     {
-      strlcpy(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
+      cupsCopyString(bufptr, choices[i]->code, (size_t)(bufend - bufptr + 1));
       bufptr += strlen(bufptr);
     }
 
index 77f99bf709e652d0a97178addf1edaf04c1663da..2c6c9be98c426c905d9a66580f51c264615d36d4 100644 (file)
@@ -74,13 +74,13 @@ ppdLocalize(ppd_file_t *ppd)                /* I - PPD file */
   {
     if ((locattr = _ppdLocalizedAttr(ppd, "Translation", group->name,
                                      ll_CC)) != NULL)
-      strlcpy(group->text, locattr->text, sizeof(group->text));
+      cupsCopyString(group->text, locattr->text, sizeof(group->text));
 
     for (j = group->num_options, option = group->options; j > 0; j --, option ++)
     {
       if ((locattr = _ppdLocalizedAttr(ppd, "Translation", option->keyword,
                                        ll_CC)) != NULL)
-       strlcpy(option->text, locattr->text, sizeof(option->text));
+       cupsCopyString(option->text, locattr->text, sizeof(option->text));
 
       for (k = option->num_choices, choice = option->choices;
            k > 0;
@@ -98,7 +98,7 @@ ppdLocalize(ppd_file_t *ppd)          /* I - PPD file */
        }
 
         if (locattr)
-         strlcpy(choice->text, locattr->text, sizeof(choice->text));
+         cupsCopyString(choice->text, locattr->text, sizeof(choice->text));
       }
     }
   }
@@ -119,7 +119,7 @@ ppdLocalize(ppd_file_t *ppd)                /* I - PPD file */
 
       if ((locattr = _ppdLocalizedAttr(ppd, ckeyword, cparam->name,
                                        ll_CC)) != NULL)
-        strlcpy(cparam->text, locattr->text, sizeof(cparam->text));
+        cupsCopyString(cparam->text, locattr->text, sizeof(cparam->text));
     }
   }
 
@@ -131,7 +131,7 @@ ppdLocalize(ppd_file_t *ppd)                /* I - PPD file */
   {
     if ((locattr = _ppdLocalizedAttr(ppd, "APCustomColorMatchingName",
                                      attr->spec, ll_CC)) != NULL)
-      strlcpy(attr->text, locattr->text, sizeof(attr->text));
+      cupsCopyString(attr->text, locattr->text, sizeof(attr->text));
   }
 
   for (attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
@@ -142,7 +142,7 @@ ppdLocalize(ppd_file_t *ppd)                /* I - PPD file */
 
     if ((locattr = _ppdLocalizedAttr(ppd, "cupsICCProfile", attr->spec,
                                      ll_CC)) != NULL)
-      strlcpy(attr->text, locattr->text, sizeof(attr->text));
+      cupsCopyString(attr->text, locattr->text, sizeof(attr->text));
 
     cupsArrayRestore(ppd->sorted_attrs);
   }
@@ -159,7 +159,7 @@ ppdLocalize(ppd_file_t *ppd)                /* I - PPD file */
 
     if ((locattr = _ppdLocalizedAttr(ppd, "APPrinterPreset", attr->spec,
                                      ll_CC)) != NULL)
-      strlcpy(attr->text, locattr->text, sizeof(attr->text));
+      cupsCopyString(attr->text, locattr->text, sizeof(attr->text));
 
     cupsArrayRestore(ppd->sorted_attrs);
   }
@@ -284,7 +284,7 @@ ppdLocalizeIPPReason(
 
       if (message && strcmp(message, msgid))
       {
-        strlcpy(buffer, _cupsLangString(lang, message), bufsize);
+        cupsCopyString(buffer, _cupsLangString(lang, message), bufsize);
        return (buffer);
       }
     }
@@ -305,7 +305,7 @@ ppdLocalizeIPPReason(
     * the value...
     */
 
-    strlcpy(buffer, locattr->text, bufsize);
+    cupsCopyString(buffer, locattr->text, bufsize);
 
     for (valptr = locattr->value, bufptr = buffer; *valptr && bufptr < bufend;)
     {
@@ -693,7 +693,7 @@ ppd_ll_CC(char   *ll_CC,            /* O - Country-specific locale name */
 
   if ((lang = cupsLangDefault()) == NULL)
   {
-    strlcpy(ll_CC, "en_US", ll_CC_size);
+    cupsCopyString(ll_CC, "en_US", ll_CC_size);
     return (NULL);
   }
 
@@ -701,7 +701,7 @@ ppd_ll_CC(char   *ll_CC,            /* O - Country-specific locale name */
   * Copy the locale name...
   */
 
-  strlcpy(ll_CC, lang->language, ll_CC_size);
+  cupsCopyString(ll_CC, lang->language, ll_CC_size);
 
   if (strlen(ll_CC) == 2)
   {
@@ -711,15 +711,15 @@ ppd_ll_CC(char   *ll_CC,          /* O - Country-specific locale name */
     */
 
     if (!strcmp(ll_CC, "cs"))
-      strlcpy(ll_CC, "cs_CZ", ll_CC_size);
+      cupsCopyString(ll_CC, "cs_CZ", ll_CC_size);
     else if (!strcmp(ll_CC, "en"))
-      strlcpy(ll_CC, "en_US", ll_CC_size);
+      cupsCopyString(ll_CC, "en_US", ll_CC_size);
     else if (!strcmp(ll_CC, "ja"))
-      strlcpy(ll_CC, "ja_JP", ll_CC_size);
+      cupsCopyString(ll_CC, "ja_JP", ll_CC_size);
     else if (!strcmp(ll_CC, "sv"))
-      strlcpy(ll_CC, "sv_SE", ll_CC_size);
+      cupsCopyString(ll_CC, "sv_SE", ll_CC_size);
     else if (!strcmp(ll_CC, "zh"))     /* Simplified Chinese */
-      strlcpy(ll_CC, "zh_CN", ll_CC_size);
+      cupsCopyString(ll_CC, "zh_CN", ll_CC_size);
   }
 
   DEBUG_printf("8ppd_ll_CC: lang->language=\"%s\", ll_CC=\"%s\"...", lang->language, ll_CC);
index be43e51dae481c7544f816d741604ad2a3f4b655..53be39c26372c5e5f604a6c8f16f80dd4e2c0a31 100644 (file)
@@ -436,7 +436,7 @@ ppdFindOption(ppd_file_t *ppd,              /* I - PPD file data */
     ppd_option_t       key;            /* Option search key */
 
 
-    strlcpy(key.keyword, option, sizeof(key.keyword));
+    cupsCopyString(key.keyword, option, sizeof(key.keyword));
 
     return ((ppd_option_t *)cupsArrayFind(ppd->options, &key));
   }
index aed4cbe741adaff6dc6f5c6863659f70482e9e6c..d16be29b968066aa6c112eab2e2c6da01e22fb13 100644 (file)
@@ -176,9 +176,9 @@ cupsGetPPD3(http_t     *http,               /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
     httpGetHostname(http, hostname, sizeof(hostname));
   else
   {
-    strlcpy(hostname, cupsServer(), sizeof(hostname));
+    cupsCopyString(hostname, cupsServer(), sizeof(hostname));
     if (hostname[0] == '/')
-      strlcpy(hostname, "localhost", sizeof(hostname));
+      cupsCopyString(hostname, "localhost", sizeof(hostname));
   }
 
   if (!_cups_strcasecmp(hostname, "localhost"))
@@ -342,7 +342,7 @@ cupsGetPPD3(http_t     *http,               /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
     * Redirect localhost to domain socket...
     */
 
-    strlcpy(hostname, cupsServer(), sizeof(hostname));
+    cupsCopyString(hostname, cupsServer(), sizeof(hostname));
     port = 0;
 
     DEBUG_printf("2cupsGetPPD3: Redirecting to \"%s\".", hostname);
@@ -357,7 +357,7 @@ cupsGetPPD3(http_t     *http,               /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
   DEBUG_printf("2cupsGetPPD3: Local hostname=\"%s\"", localhost);
 
   if (!_cups_strcasecmp(localhost, hostname))
-    strlcpy(hostname, "localhost", sizeof(hostname));
+    cupsCopyString(hostname, "localhost", sizeof(hostname));
 
  /*
   * Get the hostname and port number we are connected to...
@@ -409,7 +409,7 @@ cupsGetPPD3(http_t     *http,               /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
   * And send a request to the HTTP server...
   */
 
-  strlcat(resource, ".ppd", sizeof(resource));
+  cupsConcatString(resource, ".ppd", sizeof(resource));
 
   if (*modtime > 0)
     httpSetField(http2, HTTP_FIELD_IF_MODIFIED_SINCE,
@@ -428,7 +428,7 @@ cupsGetPPD3(http_t     *http,               /* I  - HTTP connection or @code CUPS_HTTP_DEFAUL
     *modtime = httpGetDateTime(httpGetField(http2, HTTP_FIELD_DATE));
 
     if (tempfile[0])
-      strlcpy(buffer, tempfile, bufsize);
+      cupsCopyString(buffer, tempfile, bufsize);
   }
   else if (status != HTTP_STATUS_NOT_MODIFIED)
   {
index f40bdc0a2ebb2be557dcdd8210472e6952bc434d..1d2919da18ab297ad23dc2102208456f19904df2 100644 (file)
@@ -558,20 +558,20 @@ _ppdOpen(
 
     if (!strcmp(lang->language, "zh_HK"))
     {                                  /* Traditional Chinese + variants */
-      strlcpy(ll_CC, "zh_TW.", sizeof(ll_CC));
-      strlcpy(ll, "zh_", sizeof(ll));
+      cupsCopyString(ll_CC, "zh_TW.", sizeof(ll_CC));
+      cupsCopyString(ll, "zh_", sizeof(ll));
     }
     else if (!strncmp(lang->language, "zh", 2))
-      strlcpy(ll, "zh_", sizeof(ll));  /* Any Chinese variant */
+      cupsCopyString(ll, "zh_", sizeof(ll));   /* Any Chinese variant */
     else if (!strncmp(lang->language, "jp", 2))
     {                                  /* Any Japanese variant */
-      strlcpy(ll_CC, "ja", sizeof(ll_CC));
-      strlcpy(ll, "jp", sizeof(ll));
+      cupsCopyString(ll_CC, "ja", sizeof(ll_CC));
+      cupsCopyString(ll, "jp", sizeof(ll));
     }
     else if (!strncmp(lang->language, "nb", 2) || !strncmp(lang->language, "no", 2))
     {                                  /* Any Norwegian variant */
-      strlcpy(ll_CC, "nb", sizeof(ll_CC));
-      strlcpy(ll, "no", sizeof(ll));
+      cupsCopyString(ll_CC, "nb", sizeof(ll_CC));
+      cupsCopyString(ll, "no", sizeof(ll));
     }
     else
       snprintf(ll, sizeof(ll), "%2.2s.", lang->language);
@@ -792,23 +792,23 @@ _ppdOpen(
              ppd->attrs[j]->value)
          {
            DEBUG_printf("2_ppdOpen: Setting Default%s to %s via attribute...", option->keyword, ppd->attrs[j]->value);
-           strlcpy(option->defchoice, ppd->attrs[j]->value,
+           cupsCopyString(option->defchoice, ppd->attrs[j]->value,
                    sizeof(option->defchoice));
            break;
          }
 
         if (!strcmp(keyword, "PageSize"))
-         strlcpy(option->text, _("Media Size"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Size"), sizeof(option->text));
        else if (!strcmp(keyword, "MediaType"))
-         strlcpy(option->text, _("Media Type"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Type"), sizeof(option->text));
        else if (!strcmp(keyword, "InputSlot"))
-         strlcpy(option->text, _("Media Source"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Source"), sizeof(option->text));
        else if (!strcmp(keyword, "ColorModel"))
-         strlcpy(option->text, _("Output Mode"), sizeof(option->text));
+         cupsCopyString(option->text, _("Output Mode"), sizeof(option->text));
        else if (!strcmp(keyword, "Resolution"))
-         strlcpy(option->text, _("Resolution"), sizeof(option->text));
+         cupsCopyString(option->text, _("Resolution"), sizeof(option->text));
         else
-         strlcpy(option->text, keyword, sizeof(option->text));
+         cupsCopyString(option->text, keyword, sizeof(option->text));
       }
     }
 
@@ -898,8 +898,8 @@ _ppdOpen(
       ppd->num_profiles ++;
 
       memset(profile, 0, sizeof(ppd_profile_t));
-      strlcpy(profile->resolution, name, sizeof(profile->resolution));
-      strlcpy(profile->media_type, text, sizeof(profile->media_type));
+      cupsCopyString(profile->resolution, name, sizeof(profile->resolution));
+      cupsCopyString(profile->media_type, text, sizeof(profile->media_type));
 
       profile->density      = (float)_cupsStrScand(string, &sptr, loc);
       profile->gamma        = (float)_cupsStrScand(sptr, &sptr, loc);
@@ -1127,7 +1127,7 @@ _ppdOpen(
            goto error;
          }
 
-       strlcpy(choice->text, text[0] ? text : _("Custom"),
+       cupsCopyString(choice->text, text[0] ? text : _("Custom"),
                sizeof(choice->text));
 
        choice->code = strdup(string);
@@ -1167,7 +1167,7 @@ _ppdOpen(
              goto error;
            }
 
-         strlcpy(choice->text, text[0] ? text : _("Custom"),
+         cupsCopyString(choice->text, text[0] ? text : _("Custom"),
                  sizeof(choice->text));
         }
       }
@@ -1195,7 +1195,7 @@ _ppdOpen(
       ppd->num_emulations = 1;
       ppd->emulations     = calloc(1, sizeof(ppd_emul_t));
 
-      strlcpy(ppd->emulations[0].name, string, sizeof(ppd->emulations[0].name));
+      cupsCopyString(ppd->emulations[0].name, string, sizeof(ppd->emulations[0].name));
     }
     else if (!strcmp(keyword, "JobPatchFile"))
     {
@@ -1322,7 +1322,7 @@ _ppdOpen(
            ppd->attrs[j]->value)
        {
          DEBUG_printf("2_ppdOpen: Setting Default%s to %s via attribute...", option->keyword, ppd->attrs[j]->value);
-         strlcpy(option->defchoice, ppd->attrs[j]->value,
+         cupsCopyString(option->defchoice, ppd->attrs[j]->value,
                  sizeof(option->defchoice));
          break;
        }
@@ -1333,17 +1333,17 @@ _ppdOpen(
       else
       {
         if (!strcmp(name, "PageSize"))
-         strlcpy(option->text, _("Media Size"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Size"), sizeof(option->text));
        else if (!strcmp(name, "MediaType"))
-         strlcpy(option->text, _("Media Type"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Type"), sizeof(option->text));
        else if (!strcmp(name, "InputSlot"))
-         strlcpy(option->text, _("Media Source"), sizeof(option->text));
+         cupsCopyString(option->text, _("Media Source"), sizeof(option->text));
        else if (!strcmp(name, "ColorModel"))
-         strlcpy(option->text, _("Output Mode"), sizeof(option->text));
+         cupsCopyString(option->text, _("Output Mode"), sizeof(option->text));
        else if (!strcmp(name, "Resolution"))
-         strlcpy(option->text, _("Resolution"), sizeof(option->text));
+         cupsCopyString(option->text, _("Resolution"), sizeof(option->text));
         else
-         strlcpy(option->text, name, sizeof(option->text));
+         cupsCopyString(option->text, name, sizeof(option->text));
       }
 
       option->section = PPD_ORDER_ANY;
@@ -1357,7 +1357,7 @@ _ppdOpen(
       */
 
       if (!_cups_strcasecmp(name, "PageRegion"))
-        strlcpy(custom_name, "CustomPageSize", sizeof(custom_name));
+        cupsCopyString(custom_name, "CustomPageSize", sizeof(custom_name));
       else
         snprintf(custom_name, sizeof(custom_name), "Custom%s", name);
 
@@ -1373,7 +1373,7 @@ _ppdOpen(
            goto error;
          }
 
-       strlcpy(choice->text,
+       cupsCopyString(choice->text,
                custom_attr->text[0] ? custom_attr->text : _("Custom"),
                sizeof(choice->text));
         choice->code = strdup(custom_attr->value);
@@ -1440,7 +1440,7 @@ _ppdOpen(
            ppd->attrs[j]->value)
        {
          DEBUG_printf("2_ppdOpen: Setting Default%s to %s via attribute...", option->keyword, ppd->attrs[j]->value);
-         strlcpy(option->defchoice, ppd->attrs[j]->value,
+         cupsCopyString(option->defchoice, ppd->attrs[j]->value,
                  sizeof(option->defchoice));
          break;
        }
@@ -1449,7 +1449,7 @@ _ppdOpen(
         cupsCharsetToUTF8((cups_utf8_t *)option->text, text,
                           sizeof(option->text), encoding);
       else
-        strlcpy(option->text, name, sizeof(option->text));
+        cupsCopyString(option->text, name, sizeof(option->text));
 
       option->section = PPD_ORDER_JCL;
       group = NULL;
@@ -1475,7 +1475,7 @@ _ppdOpen(
          goto error;
        }
 
-       strlcpy(choice->text,
+       cupsCopyString(choice->text,
                custom_attr->text[0] ? custom_attr->text : _("Custom"),
                sizeof(choice->text));
         choice->code = strdup(custom_attr->value);
@@ -1505,7 +1505,7 @@ _ppdOpen(
 
        if (ppdFindChoice(option, tchoice))
        {
-         strlcpy(option->defchoice, tchoice, sizeof(option->defchoice));
+         cupsCopyString(option->defchoice, tchoice, sizeof(option->defchoice));
 
          DEBUG_printf("2_ppdOpen: Reset Default%s to %s...", option->keyword, tchoice);
        }
@@ -1540,7 +1540,7 @@ _ppdOpen(
 
        if (ppdFindChoice(option, tchoice))
        {
-         strlcpy(option->defchoice, tchoice, sizeof(option->defchoice));
+         cupsCopyString(option->defchoice, tchoice, sizeof(option->defchoice));
 
          DEBUG_printf("2_ppdOpen: Reset Default%s to %s...", option->keyword, tchoice);
        }
@@ -1704,7 +1704,7 @@ _ppdOpen(
         * Set the default as part of the current option...
        */
 
-       strlcpy(option->defchoice, string, sizeof(option->defchoice));
+       cupsCopyString(option->defchoice, string, sizeof(option->defchoice));
 
         DEBUG_printf("2_ppdOpen: Set %s to %s...", keyword, option->defchoice);
       }
@@ -1729,11 +1729,11 @@ _ppdOpen(
 
            snprintf(toption->defchoice, sizeof(toption->defchoice), "_%s", string);
            if (!ppdFindChoice(toption, toption->defchoice))
-             strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
+             cupsCopyString(toption->defchoice, string, sizeof(toption->defchoice));
          }
          else
          {
-           strlcpy(toption->defchoice, string, sizeof(toption->defchoice));
+           cupsCopyString(toption->defchoice, string, sizeof(toption->defchoice));
          }
 
          DEBUG_printf("2_ppdOpen: Set %s to %s...", keyword, toption->defchoice);
@@ -1925,7 +1925,7 @@ _ppdOpen(
       {
         char cname[PPD_MAX_NAME];      /* Rewrite with a leading underscore */
         snprintf(cname, sizeof(cname), "_%s", name);
-        strlcpy(name, cname, sizeof(name));
+        cupsCopyString(name, cname, sizeof(name));
       }
 
       if ((size = ppdPageSize(ppd, name)) == NULL)
@@ -1954,7 +1954,7 @@ _ppdOpen(
       {
         char cname[PPD_MAX_NAME];      /* Rewrite with a leading underscore */
         snprintf(cname, sizeof(cname), "_%s", name);
-        strlcpy(name, cname, sizeof(name));
+        cupsCopyString(name, cname, sizeof(name));
       }
 
       if ((size = ppdPageSize(ppd, name)) == NULL)
@@ -1990,7 +1990,7 @@ _ppdOpen(
       {
         char cname[PPD_MAX_NAME];      /* Rewrite with a leading underscore */
         snprintf(cname, sizeof(cname), "_%s", name);
-        strlcpy(name, cname, sizeof(name));
+        cupsCopyString(name, cname, sizeof(name));
       }
 
       if (!strcmp(keyword, "PageSize"))
@@ -2018,11 +2018,11 @@ _ppdOpen(
         cupsCharsetToUTF8((cups_utf8_t *)choice->text, text,
                           sizeof(choice->text), encoding);
       else if (!strcmp(name, "True"))
-        strlcpy(choice->text, _("Yes"), sizeof(choice->text));
+        cupsCopyString(choice->text, _("Yes"), sizeof(choice->text));
       else if (!strcmp(name, "False"))
-        strlcpy(choice->text, _("No"), sizeof(choice->text));
+        cupsCopyString(choice->text, _("No"), sizeof(choice->text));
       else
-        strlcpy(choice->text, name, sizeof(choice->text));
+        cupsCopyString(choice->text, name, sizeof(choice->text));
 
       if (option->section == PPD_ORDER_JCL)
         ppd_decode(string);            /* Decode quoted string */
@@ -2387,14 +2387,14 @@ ppd_add_attr(ppd_file_t *ppd,           /* I - PPD file data */
   if (!_cups_strcasecmp(spec, "custom") || !_cups_strncasecmp(spec, "custom.", 7))
   {
     temp->spec[0] = '_';
-    strlcpy(temp->spec + 1, spec, sizeof(temp->spec) - 1);
+    cupsCopyString(temp->spec + 1, spec, sizeof(temp->spec) - 1);
   }
   else {
-      strlcpy(temp->spec, spec, sizeof(temp->spec));
+      cupsCopyString(temp->spec, spec, sizeof(temp->spec));
   }
 
-  strlcpy(temp->name, name, sizeof(temp->name));
-  strlcpy(temp->text, text, sizeof(temp->text));
+  cupsCopyString(temp->name, name, sizeof(temp->name));
+  cupsCopyString(temp->text, text, sizeof(temp->text));
   temp->value = (char *)value;
 
  /*
@@ -2435,7 +2435,7 @@ ppd_add_choice(ppd_option_t *option,      /* I - Option */
   option->num_choices ++;
 
   memset(choice, 0, sizeof(ppd_choice_t));
-  strlcpy(choice->choice, name, sizeof(choice->choice));
+  cupsCopyString(choice->choice, name, sizeof(choice->choice));
 
   return (choice);
 }
@@ -2465,7 +2465,7 @@ ppd_add_size(ppd_file_t *ppd,             /* I - PPD file */
   ppd->num_sizes ++;
 
   memset(size, 0, sizeof(ppd_size_t));
-  strlcpy(size->name, name, sizeof(size->name));
+  cupsCopyString(size->name, name, sizeof(size->name));
 
   return (size);
 }
@@ -2684,7 +2684,7 @@ ppd_get_coption(ppd_file_t *ppd,  /* I - PPD file */
   if ((copt = calloc(1, sizeof(ppd_coption_t))) == NULL)
     return (NULL);
 
-  strlcpy(copt->keyword, name, sizeof(copt->keyword));
+  cupsCopyString(copt->keyword, name, sizeof(copt->keyword));
 
   copt->params = cupsArrayNew((cups_array_func_t)NULL, NULL);
 
@@ -2725,8 +2725,8 @@ ppd_get_cparam(ppd_coption_t *opt,        /* I - PPD file */
     return (NULL);
 
   cparam->type = PPD_CUSTOM_UNKNOWN;
-  strlcpy(cparam->name, param, sizeof(cparam->name));
-  strlcpy(cparam->text, text[0] ? text : param, sizeof(cparam->text));
+  cupsCopyString(cparam->name, param, sizeof(cparam->name));
+  cupsCopyString(cparam->text, text[0] ? text : param, sizeof(cparam->text));
 
  /*
   * Add this record to the array...
@@ -2791,7 +2791,7 @@ ppd_get_group(ppd_file_t      *ppd,       /* I - PPD file */
     ppd->num_groups ++;
 
     memset(group, 0, sizeof(ppd_group_t));
-    strlcpy(group->name, name, sizeof(group->name));
+    cupsCopyString(group->name, name, sizeof(group->name));
 
     cupsCharsetToUTF8((cups_utf8_t *)group->text, text,
                       sizeof(group->text), encoding);
@@ -2834,7 +2834,7 @@ ppd_get_option(ppd_group_t *group,        /* I - Group */
     group->num_options ++;
 
     memset(option, 0, sizeof(ppd_option_t));
-    strlcpy(option->keyword, name, sizeof(option->keyword));
+    cupsCopyString(option->keyword, name, sizeof(option->keyword));
   }
 
   return (option);
index 01d7976fe36e27f86ce7eaafa642edcfd237312f..bf17a47baa10c16e91ef69db529ea1099153a273 100644 (file)
@@ -920,7 +920,7 @@ pwgMediaForPWG(const char *pwg)             /* I - PWG size name */
         size->width  = w;
         size->length = l;
 
-        strlcpy(cg->pwg_name, pwg, sizeof(cg->pwg_name));
+        cupsCopyString(cg->pwg_name, pwg, sizeof(cg->pwg_name));
        size->pwg = cg->pwg_name;
 
         if (numer == 100)
index f25c9a22cd8175b5dd04f93738558b7693ddfc8a..23128ecd5464e2e66c17e47a711fa3057cac1780 100644 (file)
@@ -175,7 +175,7 @@ _cupsRasterInterpretPPD(
   h->cupsImagingBBox[2]          = 612.0f;
   h->cupsImagingBBox[3]          = 792.0f;
 
-  strlcpy(h->cupsPageSizeName, "Letter", sizeof(h->cupsPageSizeName));
+  cupsCopyString(h->cupsPageSizeName, "Letter", sizeof(h->cupsPageSizeName));
 
 #ifdef __APPLE__
  /*
@@ -259,7 +259,7 @@ _cupsRasterInterpretPPD(
     right  = size->right;
     top    = size->top;
 
-    strlcpy(h->cupsPageSizeName, size->name, sizeof(h->cupsPageSizeName));
+    cupsCopyString(h->cupsPageSizeName, size->name, sizeof(h->cupsPageSizeName));
 
     h->cupsPageSize[0] = size->width;
     h->cupsPageSize[1] = size->length;
@@ -1455,13 +1455,13 @@ setpagedevice(
     */
 
     if (!strcmp(name, "MediaClass") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->MediaClass, obj->value.string, sizeof(h->MediaClass));
+      cupsCopyString(h->MediaClass, obj->value.string, sizeof(h->MediaClass));
     else if (!strcmp(name, "MediaColor") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->MediaColor, obj->value.string, sizeof(h->MediaColor));
+      cupsCopyString(h->MediaColor, obj->value.string, sizeof(h->MediaColor));
     else if (!strcmp(name, "MediaType") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->MediaType, obj->value.string, sizeof(h->MediaType));
+      cupsCopyString(h->MediaType, obj->value.string, sizeof(h->MediaType));
     else if (!strcmp(name, "OutputType") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->OutputType, obj->value.string, sizeof(h->OutputType));
+      cupsCopyString(h->OutputType, obj->value.string, sizeof(h->OutputType));
     else if (!strcmp(name, "AdvanceDistance") && obj->type == CUPS_PS_NUMBER)
       h->AdvanceDistance = (unsigned)obj->value.number;
     else if (!strcmp(name, "AdvanceMedia") && obj->type == CUPS_PS_NUMBER)
@@ -1580,16 +1580,16 @@ setpagedevice(
       if ((i = atoi(name + 10)) < 0 || i > 15)
         return (-1);
 
-      strlcpy(h->cupsString[i], obj->value.string, sizeof(h->cupsString[i]));
+      cupsCopyString(h->cupsString[i], obj->value.string, sizeof(h->cupsString[i]));
     }
     else if (!strcmp(name, "cupsMarkerType") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->cupsMarkerType, obj->value.string, sizeof(h->cupsMarkerType));
+      cupsCopyString(h->cupsMarkerType, obj->value.string, sizeof(h->cupsMarkerType));
     else if (!strcmp(name, "cupsPageSizeName") && obj->type == CUPS_PS_STRING)
-      strlcpy(h->cupsPageSizeName, obj->value.string,
+      cupsCopyString(h->cupsPageSizeName, obj->value.string,
               sizeof(h->cupsPageSizeName));
     else if (!strcmp(name, "cupsRenderingIntent") &&
              obj->type == CUPS_PS_STRING)
-      strlcpy(h->cupsRenderingIntent, obj->value.string,
+      cupsCopyString(h->cupsRenderingIntent, obj->value.string,
               sizeof(h->cupsRenderingIntent));
     else
     {
index 85c30b3de78e14d603d1562e5d2a580f1f35fa2c..c3e9f06e65a786a1ef70392e877e7441e442d3a8 100644 (file)
@@ -219,7 +219,7 @@ _cupsRasterInitPWGHeader(
 
   memset(h, 0, sizeof(cups_page_header2_t));
 
-  strlcpy(h->cupsPageSizeName, media->pwg, sizeof(h->cupsPageSizeName));
+  cupsCopyString(h->cupsPageSizeName, media->pwg, sizeof(h->cupsPageSizeName));
 
   h->PageSize[0] = (unsigned)(72 * media->width / 2540);
   h->PageSize[1] = (unsigned)(72 * media->length / 2540);
@@ -679,7 +679,7 @@ _cupsRasterReadHeader(
            return (0);
          }
 
-         strlcpy(r->header.MediaClass, "PwgRaster", sizeof(r->header.MediaClass));
+         cupsCopyString(r->header.MediaClass, "PwgRaster", sizeof(r->header.MediaClass));
                                              /* PwgRaster */
           r->header.cupsBitsPerPixel = appleheader[0];
           r->header.cupsColorSpace   = appleheader[1] >= (sizeof(rawcspace) / sizeof(rawcspace[0])) ? CUPS_CSPACE_DEVICE1 : rawcspace[appleheader[1]];
@@ -710,9 +710,9 @@ _cupsRasterReadHeader(
           r->header.MediaPosition = appleheader[5];
 
           if (appleheader[4] < (int)(sizeof(apple_media_types) / sizeof(apple_media_types[0])))
-            strlcpy(r->header.MediaType, apple_media_types[appleheader[4]], sizeof(r->header.MediaType));
+            cupsCopyString(r->header.MediaType, apple_media_types[appleheader[4]], sizeof(r->header.MediaType));
           else
-            strlcpy(r->header.MediaType, "other", sizeof(r->header.MediaType));
+            cupsCopyString(r->header.MediaType, "other", sizeof(r->header.MediaType));
         }
         break;
   }
@@ -1048,13 +1048,13 @@ _cupsRasterWriteHeader(
     cups_page_header2_t        fh;             /* File page header */
 
     memset(&fh, 0, sizeof(fh));
-    strlcpy(fh.MediaClass, "PwgRaster", sizeof(fh.MediaClass));
-    strlcpy(fh.MediaColor, r->header.MediaColor, sizeof(fh.MediaColor));
-    strlcpy(fh.MediaType, r->header.MediaType, sizeof(fh.MediaType));
-    strlcpy(fh.OutputType, r->header.OutputType, sizeof(fh.OutputType));
-    strlcpy(fh.cupsRenderingIntent, r->header.cupsRenderingIntent,
+    cupsCopyString(fh.MediaClass, "PwgRaster", sizeof(fh.MediaClass));
+    cupsCopyString(fh.MediaColor, r->header.MediaColor, sizeof(fh.MediaColor));
+    cupsCopyString(fh.MediaType, r->header.MediaType, sizeof(fh.MediaType));
+    cupsCopyString(fh.OutputType, r->header.OutputType, sizeof(fh.OutputType));
+    cupsCopyString(fh.cupsRenderingIntent, r->header.cupsRenderingIntent,
             sizeof(fh.cupsRenderingIntent));
-    strlcpy(fh.cupsPageSizeName, r->header.cupsPageSizeName,
+    cupsCopyString(fh.cupsPageSizeName, r->header.cupsPageSizeName,
             sizeof(fh.cupsPageSizeName));
 
     fh.CutMedia              = htonl(r->header.CutMedia);
index 91e53f5e6f643fe224fd5093b235c8aa6a43d8eb..10b8a5c9cf58799e788ee6defaca4cb1f876d6f8 100644 (file)
@@ -490,7 +490,7 @@ cupsSideChannelSNMPWalk(
       */
 
       current_oid = real_data;
-      strlcpy(last_oid, current_oid, sizeof(last_oid));
+      cupsCopyString(last_oid, current_oid, sizeof(last_oid));
     }
   }
   while (status == CUPS_SC_STATUS_OK);
index f5451bce0dde6d0cf55d646af2bab334a6693875..e81579debae60a173fdb34acb5ffc967daf66cf8 100644 (file)
@@ -121,7 +121,7 @@ _cupsSNMPDefaultCommunity(void)
 
   if (!cg->snmp_community[0])
   {
-    strlcpy(cg->snmp_community, "public", sizeof(cg->snmp_community));
+    cupsCopyString(cg->snmp_community, "public", sizeof(cg->snmp_community));
 
     snprintf(line, sizeof(line), "%s/snmp.conf", cg->cups_serverroot);
     if ((fp = cupsFileOpen(line, "r")) != NULL)
@@ -131,7 +131,7 @@ _cupsSNMPDefaultCommunity(void)
        if (!_cups_strcasecmp(line, "Community"))
        {
          if (value)
-           strlcpy(cg->snmp_community, value, sizeof(cg->snmp_community));
+           cupsCopyString(cg->snmp_community, value, sizeof(cg->snmp_community));
          else
            cg->snmp_community[0] = '\0';
 
@@ -668,7 +668,7 @@ _cupsSNMPWrite(
   packet.request_id   = request_id;
   packet.object_type  = CUPS_ASN1_NULL_VALUE;
 
-  strlcpy(packet.community, community, sizeof(packet.community));
+  cupsCopyString(packet.community, community, sizeof(packet.community));
 
   for (i = 0; oid[i] >= 0 && i < (CUPS_SNMP_MAX_OID - 1); i ++)
     packet.object_name[i] = oid[i];
index 170ddae449ca44620faa51731098ec1931b80542..4d9f6501444e97213d48608b68e706c3e8b28dae 100644 (file)
@@ -184,7 +184,7 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            {
              if ((bufptr + templen) > bufend)
              {
-               strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+               cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
                bufptr = bufend;
              }
              else
@@ -216,7 +216,7 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            {
              if ((bufptr + templen) > bufend)
              {
-               strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+               cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
                bufptr = bufend;
              }
              else
@@ -241,7 +241,7 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            {
              if ((bufptr + templen) > bufend)
              {
-               strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
+               cupsCopyString(bufptr, temp, (size_t)(bufend - bufptr));
                bufptr = bufend;
              }
              else
index 4aeef79b9c4294aecd34e8e3adb2dbe6d1a3bd14..67305dd9d3938a8390d8fae57b2bf0f9c1544c60 100644 (file)
@@ -347,7 +347,7 @@ _cupsStrFormatd(char         *buf,  /* I - String */
   }
   else
   {
-    strlcpy(buf, temp, (size_t)(bufend - buf + 1));
+    cupsCopyString(buf, temp, (size_t)(bufend - buf + 1));
     bufptr = buf + strlen(buf);
   }
 
@@ -521,7 +521,7 @@ _cupsStrScand(const char   *buf,    /* I - Pointer to number */
 
     if (loc && loc->decimal_point)
     {
-      strlcpy(tempptr, loc->decimal_point, sizeof(temp) - (size_t)(tempptr - temp));
+      cupsCopyString(tempptr, loc->decimal_point, sizeof(temp) - (size_t)(tempptr - temp));
       tempptr += strlen(tempptr);
     }
     else if (tempptr < (temp + sizeof(temp) - 1))
@@ -728,11 +728,11 @@ _cups_strncasecmp(const char *s,  /* I - First string */
 
 #ifndef HAVE_STRLCAT
 /*
- * '_cups_strlcat()' - Safely concatenate two strings.
+ * '_cups_cupsConcatString()' - Safely concatenate two strings.
  */
 
 size_t                                 /* O - Length of string */
-_cups_strlcat(char       *dst,         /* O - Destination string */
+_cups_cupsConcatString(char       *dst,                /* O - Destination string */
               const char *src,         /* I - Source string */
              size_t     size)          /* I - Size of destination string buffer */
 {
@@ -774,11 +774,11 @@ _cups_strlcat(char       *dst,            /* O - Destination string */
 
 #ifndef HAVE_STRLCPY
 /*
- * '_cups_strlcpy()' - Safely copy two strings.
+ * '_cups_cupsCopyString()' - Safely copy two strings.
  */
 
 size_t                                 /* O - Length of string */
-_cups_strlcpy(char       *dst,         /* O - Destination string */
+_cups_cupsCopyString(char       *dst,          /* O - Destination string */
               const char *src,         /* I - Source string */
              size_t      size)         /* I - Size of destination string buffer */
 {
index 185fcbec57c0a621a0176aee5eb7ccc367840f21..1765b5edc7763a2e82fdf14d3688f0a903f5a2b2 100644 (file)
@@ -303,7 +303,7 @@ main(void)
       * the same buffer in the first place... :)
       */
 
-      strlcpy(word, text, sizeof(word));
+      cupsCopyString(word, text, sizeof(word));
 
      /*
       * Grab the next word and compare...
index f265285a1c8a1bff2e1fc6c957085b134f389be8..af2a09239af3cfa070a00b4dba5392ef65cdd4a4 100644 (file)
@@ -692,7 +692,7 @@ monitor_printer(
         printf("PRINTER: %s (%s)\n", ippEnumString("printer-state", (int)printer_state), printer_state_reasons);
 
         data->printer_state = printer_state;
-        strlcpy(data->printer_state_reasons, printer_state_reasons, sizeof(data->printer_state_reasons));
+        cupsCopyString(data->printer_state_reasons, printer_state_reasons, sizeof(data->printer_state_reasons));
       }
 
       ippDelete(response);
@@ -722,7 +722,7 @@ monitor_printer(
           printf("JOB %d: %s (%s)\n", data->job_id, ippEnumString("job-state", (int)job_state), job_state_reasons);
 
           data->job_state = job_state;
-          strlcpy(data->job_state_reasons, job_state_reasons, sizeof(data->job_state_reasons));
+          cupsCopyString(data->job_state_reasons, job_state_reasons, sizeof(data->job_state_reasons));
         }
 
         ippDelete(response);
index 7be0fa2770ede960e573e5b23713a0244100827a..33c77d9e57d1210e88b7648a6b23287c22e4c028 100644 (file)
@@ -271,7 +271,7 @@ main(int  argc,                             /* I - Argument Count */
 
   fputs("cupsCharsetToUTF8(CUPS_ISO8859_1): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_1);
   if ((size_t)len != strlen((char *)utf8latin))
@@ -322,7 +322,7 @@ main(int  argc,                             /* I - Argument Count */
 
   fputs("cupsCharsetToUTF8(CUPS_ISO8859_7): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_7);
   if ((size_t)len != strlen((char *)utf8greek))
@@ -368,7 +368,7 @@ main(int  argc,                             /* I - Argument Count */
 
   fputs("cupsCharsetToUTF8(CUPS_WINDOWS_932): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_932);
   if ((size_t)len != strlen((char *)utf8japan))
@@ -415,7 +415,7 @@ main(int  argc,                             /* I - Argument Count */
 #if !defined(__linux__) && !defined(__GLIBC__)
   fputs("cupsCharsetToUTF8(CUPS_EUC_JP): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_JP);
   if ((size_t)len != strlen((char *)utf8japan))
@@ -462,7 +462,7 @@ main(int  argc,                             /* I - Argument Count */
 
   fputs("cupsCharsetToUTF8(CUPS_WINDOWS_950): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_950);
   if ((size_t)len != strlen((char *)utf8taiwan))
@@ -508,7 +508,7 @@ main(int  argc,                             /* I - Argument Count */
 
   fputs("cupsCharsetToUTF8(CUPS_EUC_TW): ", stdout);
 
-  strlcpy(legsrc, legdest, sizeof(legsrc));
+  cupsCopyString(legsrc, legdest, sizeof(legsrc));
 
   len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_TW);
   if ((size_t)len != strlen((char *)utf8taiwan))
index 7a4746bc95969358a956bf89d7ed18436668ea25..f4eb10a88b4dd40f544c2ad7346d9730a7db46d1 100644 (file)
@@ -1175,7 +1175,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
 
       if ((realsize = readlink(filename, realfile, sizeof(realfile) - 1)) < 0)
-        strlcpy(realfile, "Unknown", sizeof(realfile));
+        cupsCopyString(realfile, "Unknown", sizeof(realfile));
       else
         realfile[realsize] = '\0';
 
index de72a4bfbbfed5d57860256099ac91e4c238993b..65beb8cf385031ad56a830369b5ebe24b061d23e 100644 (file)
@@ -173,7 +173,7 @@ do_raster_tests(cups_mode_t mode)   /* O - Write mode */
     header.cupsPageSize[0]  = 288.0f;
     header.cupsPageSize[1]  = 288.0f;
 
-    strlcpy(header.MediaType, "auto", sizeof(header.MediaType));
+    cupsCopyString(header.MediaType, "auto", sizeof(header.MediaType));
 
     if (page & 1)
     {
@@ -309,7 +309,7 @@ do_raster_tests(cups_mode_t mode)   /* O - Write mode */
     expected.PageSize[0]      = 288;
     expected.PageSize[1]      = 288;
 
-    strlcpy(expected.MediaType, "auto", sizeof(expected.MediaType));
+    cupsCopyString(expected.MediaType, "auto", sizeof(expected.MediaType));
 
     if (mode != CUPS_RASTER_WRITE_PWG)
     {
@@ -319,7 +319,7 @@ do_raster_tests(cups_mode_t mode)   /* O - Write mode */
 
     if (mode >= CUPS_RASTER_WRITE_PWG)
     {
-      strlcpy(expected.MediaClass, "PwgRaster", sizeof(expected.MediaClass));
+      cupsCopyString(expected.MediaClass, "PwgRaster", sizeof(expected.MediaClass));
       expected.cupsInteger[7] = 0xffffff;
     }
 
index 28755f4e1ad25a6107009c24c0e1973c54778b1e..2ee660d87af7b3bee49e066943bb6e2c5153e985 100644 (file)
@@ -101,7 +101,7 @@ cupsCharsetToUTF8(
   if (encoding == CUPS_UTF8 || encoding <= CUPS_US_ASCII ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
-    strlcpy((char *)dest, src, (size_t)maxout);
+    cupsCopyString((char *)dest, src, (size_t)maxout);
     return ((int)strlen((char *)dest));
   }
 
@@ -222,7 +222,7 @@ cupsUTF8ToCharset(
   if (encoding == CUPS_UTF8 ||
       encoding >= CUPS_ENCODING_VBCS_END)
   {
-    strlcpy(dest, (char *)src, (size_t)maxout);
+    cupsCopyString(dest, (char *)src, (size_t)maxout);
     return ((int)strlen(dest));
   }
 
index 22821c21b247784db257173fa8c857c8ed7fb614..053bdd21335a4f00d7ee132c4af9463e10850764 100644 (file)
@@ -496,7 +496,7 @@ cupsSetServer(const char *server)   /* I - Server name */
 
   if (server)
   {
-    strlcpy(cg->server, server, sizeof(cg->server));
+    cupsCopyString(cg->server, server, sizeof(cg->server));
 
     if (cg->server[0] != '/' && (options = strrchr(cg->server, '/')) != NULL)
     {
@@ -528,9 +528,9 @@ cupsSetServer(const char *server)   /* I - Server name */
       cups_set_default_ipp_port(cg);
 
     if (cg->server[0] == '/')
-      strlcpy(cg->servername, "localhost", sizeof(cg->servername));
+      cupsCopyString(cg->servername, "localhost", sizeof(cg->servername));
     else
-      strlcpy(cg->servername, cg->server, sizeof(cg->servername));
+      cupsCopyString(cg->servername, cg->server, sizeof(cg->servername));
   }
   else
   {
@@ -587,7 +587,7 @@ cupsSetUser(const char *user)               /* I - User name */
 
 
   if (user)
-    strlcpy(cg->user, user, sizeof(cg->user));
+    cupsCopyString(cg->user, user, sizeof(cg->user));
   else
     cg->user[0] = '\0';
 }
@@ -622,7 +622,7 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
 
   if (user_agent)
   {
-    strlcpy(cg->user_agent, user_agent, sizeof(cg->user_agent));
+    cupsCopyString(cg->user_agent, user_agent, sizeof(cg->user_agent));
     return;
   }
 
@@ -635,7 +635,7 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
          cg->user_agent[0] = '\0';
          break;
       case _CUPS_UATOKENS_PRODUCT_ONLY :
-         strlcpy(cg->user_agent, "CUPS IPP", sizeof(cg->user_agent));
+         cupsCopyString(cg->user_agent, "CUPS IPP", sizeof(cg->user_agent));
          break;
       case _CUPS_UATOKENS_MAJOR :
          snprintf(cg->user_agent, sizeof(cg->user_agent), "CUPS/%d IPP/2", CUPS_VERSION_MAJOR);
@@ -644,7 +644,7 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
          snprintf(cg->user_agent, sizeof(cg->user_agent), "CUPS/%d.%d IPP/2.1", CUPS_VERSION_MAJOR, CUPS_VERSION_MINOR);
          break;
       case _CUPS_UATOKENS_MINIMAL :
-         strlcpy(cg->user_agent, CUPS_MINIMAL " IPP/2.1", sizeof(cg->user_agent));
+         cupsCopyString(cg->user_agent, CUPS_MINIMAL " IPP/2.1", sizeof(cg->user_agent));
          break;
     }
   }
@@ -711,7 +711,7 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
   if (!sysctlbyname("kern.osproductversion", version, &len, NULL, 0))
     version[len] = '\0';
   else
-    strlcpy(version, "unknown", sizeof(version));
+    cupsCopyString(version, "unknown", sizeof(version));
 
 #  if TARGET_OS_OSX
   if (cg->uatokens == _CUPS_UATOKENS_OS)
@@ -1138,11 +1138,11 @@ _cupsSetDefaults(void)
     cups_set_default_ipp_port(cg);
 
   if (!cg->user[0])
-    strlcpy(cg->user, cc.user, sizeof(cg->user));
+    cupsCopyString(cg->user, cc.user, sizeof(cg->user));
 
 #ifdef HAVE_GSSAPI
   if (!cg->gss_service_name[0])
-    strlcpy(cg->gss_service_name, cc.gss_service_name, sizeof(cg->gss_service_name));
+    cupsCopyString(cg->gss_service_name, cc.gss_service_name, sizeof(cg->gss_service_name));
 #endif /* HAVE_GSSAPI */
 
   if (cg->trust_first < 0)
@@ -1338,7 +1338,7 @@ cups_finalize_client_conf(
       getpwuid_r(getuid(), &pw, cg->pw_buf, PW_BUF_SIZE, &result);
 
     if (result)
-      strlcpy(cc->user, pw.pw_name, sizeof(cc->user));
+      cupsCopyString(cc->user, pw.pw_name, sizeof(cc->user));
     else
 #endif /* _WIN32 */
     {
@@ -1346,7 +1346,7 @@ cups_finalize_client_conf(
       * Use the default "unknown" user name...
       */
 
-      strlcpy(cc->user, "unknown", sizeof(cc->user));
+      cupsCopyString(cc->user, "unknown", sizeof(cc->user));
     }
   }
 
@@ -1410,11 +1410,11 @@ cups_init_client_conf(
     sval[0] = '\0';
 
     if (cups_apple_get_boolean(kAllowRC4, &bval) && bval)
-      strlcat(sval, " AllowRC4", sizeof(sval));
+      cupsConcatString(sval, " AllowRC4", sizeof(sval));
     if (cups_apple_get_boolean(kAllowSSL3, &bval) && bval)
-      strlcat(sval, " AllowSSL3", sizeof(sval));
+      cupsConcatString(sval, " AllowSSL3", sizeof(sval));
     if (cups_apple_get_boolean(kAllowDH, &bval) && bval)
-      strlcat(sval, " AllowDH", sizeof(sval));
+      cupsConcatString(sval, " AllowDH", sizeof(sval));
 
     if (sval[0])
       cups_set_ssl_options(cc, sval);
@@ -1430,7 +1430,7 @@ cups_init_client_conf(
     cups_set_digestoptions(cc, sval);
 
   if (cups_apple_get_string(kUserKey, sval, sizeof(sval)))
-    strlcpy(cc->user, sval, sizeof(cc->user));
+    cupsCopyString(cc->user, sval, sizeof(cc->user));
 
   if (cups_apple_get_string(kUserAgentTokensKey, sval, sizeof(sval)))
     cups_set_uatokens(cc, sval);
@@ -1561,7 +1561,7 @@ cups_set_gss_service_name(
     _cups_client_conf_t *cc,           /* I - client.conf values */
     const char          *value)                /* I - Value */
 {
-  strlcpy(cc->gss_service_name, value, sizeof(cc->gss_service_name));
+  cupsCopyString(cc->gss_service_name, value, sizeof(cc->gss_service_name));
 }
 #endif /* HAVE_GSSAPI */
 
@@ -1575,7 +1575,7 @@ cups_set_server_name(
     _cups_client_conf_t *cc,           /* I - client.conf values */
     const char          *value)                /* I - Value */
 {
-  strlcpy(cc->server_name, value, sizeof(cc->server_name));
+  cupsCopyString(cc->server_name, value, sizeof(cc->server_name));
 }
 
 
@@ -1600,7 +1600,7 @@ cups_set_ssl_options(
        *end;                           /* End of option */
 
 
-  strlcpy(temp, value, sizeof(temp));
+  cupsCopyString(temp, value, sizeof(temp));
 
   for (start = temp; *start; start = end)
   {
@@ -1698,5 +1698,5 @@ cups_set_user(
     _cups_client_conf_t *cc,           /* I - client.conf values */
     const char          *value)                /* I - Value */
 {
-  strlcpy(cc->user, value, sizeof(cc->user));
+  cupsCopyString(cc->user, value, sizeof(cc->user));
 }
index aa487cb41e43f20f78bf9f973cf2a38129df3977..0c11f19d2da8ccb92f4dc233504131d19190f269 100644 (file)
@@ -362,7 +362,7 @@ cupsGetDefault2(http_t *http)               /* I - Connection to server or @code CUPS_HTTP_DE
     if ((attr = ippFindAttribute(response, "printer-name",
                                  IPP_TAG_NAME)) != NULL)
     {
-      strlcpy(cg->def_printer, attr->values[0].string.text,
+      cupsCopyString(cg->def_printer, attr->values[0].string.text,
               sizeof(cg->def_printer));
       ippDelete(response);
       return (cg->def_printer);
@@ -481,7 +481,7 @@ cupsGetJobs2(http_t     *http,              /* I - Connection to server or @code CUPS_HTTP_D
     }
   }
   else
-    strlcpy(uri, "ipp://localhost/", sizeof(uri));
+    cupsCopyString(uri, "ipp://localhost/", sizeof(uri));
 
   if (!http)
     if ((http = _cupsConnect()) == NULL)
index 0a8c1f6ec1d4cf466f9b193d6b312aff81fcb52f..c14e55f26557c51cb71d32ce1c1d3102215313a1 100644 (file)
@@ -201,7 +201,7 @@ ppdxWriteData(const char *name,             /* I - Base name of keyword */
   if (!name || (!data && datasize > 0) || datasize > PPDX_MAX_DATA)
     return;
 
-  strlcpy(line, "PPD:", sizeof(line));
+  cupsCopyString(line, "PPD:", sizeof(line));
   lineptr = line + 4;
   lineend = line + sizeof(line) - 2;
 
@@ -254,7 +254,7 @@ ppdxWriteData(const char *name,             /* I - Base name of keyword */
        lineptr = line + 4;
       }
 
-      strlcpy(lineptr, pair, lineend - lineptr);
+      cupsCopyString(lineptr, pair, lineend - lineptr);
       lineptr += len;
 
      /*
@@ -286,7 +286,7 @@ ppdxWriteData(const char *name,             /* I - Base name of keyword */
     lineptr = line + 4;
   }
 
-  strlcpy(lineptr, pair, lineend - lineptr);
+  cupsCopyString(lineptr, pair, lineend - lineptr);
   lineptr += len;
 
   *lineptr++ = '\n';
index 81c25ba9aa07518c6015a41c9d3577b8e0e775b2..c4dd4ab7ed6907f33d475a63ca0a20f58023ce66 100644 (file)
@@ -218,16 +218,16 @@ main(int  argc,                           /* I - Number of command-line args */
                              options)) != NULL)
     {
       if (!strcmp(val, "automatic"))
-        strlcpy(outheader.OutputType, "Automatic",
+        cupsCopyString(outheader.OutputType, "Automatic",
                 sizeof(outheader.OutputType));
       else if (!strcmp(val, "graphics"))
-        strlcpy(outheader.OutputType, "Graphics", sizeof(outheader.OutputType));
+        cupsCopyString(outheader.OutputType, "Graphics", sizeof(outheader.OutputType));
       else if (!strcmp(val, "photo"))
-        strlcpy(outheader.OutputType, "Photo", sizeof(outheader.OutputType));
+        cupsCopyString(outheader.OutputType, "Photo", sizeof(outheader.OutputType));
       else if (!strcmp(val, "text"))
-        strlcpy(outheader.OutputType, "Text", sizeof(outheader.OutputType));
+        cupsCopyString(outheader.OutputType, "Text", sizeof(outheader.OutputType));
       else if (!strcmp(val, "text-and-graphics"))
-        strlcpy(outheader.OutputType, "TextAndGraphics",
+        cupsCopyString(outheader.OutputType, "TextAndGraphics",
                 sizeof(outheader.OutputType));
       else
       {
@@ -253,22 +253,22 @@ main(int  argc,                           /* I - Number of command-line args */
                              options)) != NULL)
     {
       if (!strcmp(val, "absolute"))
-        strlcpy(outheader.cupsRenderingIntent, "Absolute",
+        cupsCopyString(outheader.cupsRenderingIntent, "Absolute",
                 sizeof(outheader.cupsRenderingIntent));
       else if (!strcmp(val, "automatic"))
-        strlcpy(outheader.cupsRenderingIntent, "Automatic",
+        cupsCopyString(outheader.cupsRenderingIntent, "Automatic",
                 sizeof(outheader.cupsRenderingIntent));
       else if (!strcmp(val, "perceptual"))
-        strlcpy(outheader.cupsRenderingIntent, "Perceptual",
+        cupsCopyString(outheader.cupsRenderingIntent, "Perceptual",
                 sizeof(outheader.cupsRenderingIntent));
       else if (!strcmp(val, "relative"))
-        strlcpy(outheader.cupsRenderingIntent, "Relative",
+        cupsCopyString(outheader.cupsRenderingIntent, "Relative",
                 sizeof(outheader.cupsRenderingIntent));
       else if (!strcmp(val, "relative-bpc"))
-        strlcpy(outheader.cupsRenderingIntent, "RelativeBpc",
+        cupsCopyString(outheader.cupsRenderingIntent, "RelativeBpc",
                 sizeof(outheader.cupsRenderingIntent));
       else if (!strcmp(val, "saturation"))
-        strlcpy(outheader.cupsRenderingIntent, "Saturation",
+        cupsCopyString(outheader.cupsRenderingIntent, "Saturation",
                 sizeof(outheader.cupsRenderingIntent));
       else
       {
@@ -279,7 +279,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
     if (inheader.cupsPageSizeName[0] && (pwg_size = _ppdCacheGetSize(cache, inheader.cupsPageSizeName)) != NULL && pwg_size->map.pwg)
     {
-      strlcpy(outheader.cupsPageSizeName, pwg_size->map.pwg,
+      cupsCopyString(outheader.cupsPageSizeName, pwg_size->map.pwg,
              sizeof(outheader.cupsPageSizeName));
     }
     else
@@ -288,7 +288,7 @@ main(int  argc,                             /* I - Number of command-line args */
                                  (int)(2540.0 * inheader.cupsPageSize[1] / 72.0));
 
       if (pwg_media)
-        strlcpy(outheader.cupsPageSizeName, pwg_media->pwg,
+        cupsCopyString(outheader.cupsPageSizeName, pwg_media->pwg,
                 sizeof(outheader.cupsPageSizeName));
       else
       {
index b539abab0c93b89873422be9713eea1ee152429d..4c2c1ecc33d7cd09aac2f86f5500c5e0cbf950aa 100644 (file)
@@ -811,7 +811,7 @@ main(int  argc,                             /* I - Number of command-line args */
         * Anchor for HTML output...
         */
 
-        strlcpy(anchor, line + 4, sizeof(anchor));
+        cupsCopyString(anchor, line + 4, sizeof(anchor));
       }
       else if (strncmp(line, ".\\\"", 3))
       {
@@ -856,7 +856,7 @@ main(int  argc,                             /* I - Number of command-line args */
         if (!line[0])
           continue;                    // Skip initial blank line
       }
-      
+
       html_fputs(line, &font, outfile);
       putc('\n', outfile);
 
@@ -944,7 +944,7 @@ html_alternate(const char *s,               /* I - String */
                manfile[1024],          // Man page filename
                manurl[1024];           // Man page URL
 
-        strlcpy(name, s, sizeof(name));
+        cupsCopyString(name, s, sizeof(name));
         if ((size_t)(end - s) < sizeof(name))
           name[end - s] = '\0';
 
index 1ebd2eaf47e6d64a21958678ac840c8055f6f1fc..03f171dd95f67edad21faa3a675846f2a008f481 100644 (file)
@@ -440,7 +440,7 @@ main(int  argc,                             /* I - Number of command-line args */
            if (i)
              *p++ = ',';
 
-           strlcpy(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - printer_reasons));
+           cupsCopyString(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - printer_reasons));
            p += strlen(p);
          }
          if (!dbus_message_iter_append_string(&iter, &printer_reasons))
@@ -512,7 +512,7 @@ main(int  argc,                             /* I - Number of command-line args */
          if (i)
            *p++ = ',';
 
-         strlcpy(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - job_reasons));
+         cupsCopyString(p, ippGetString(attr, i, NULL), reasons_length - (size_t)(p - job_reasons));
          p += strlen(p);
        }
        if (!dbus_message_iter_append_string(&iter, &job_reasons))
index 8a75c50134010783b246ffe88ed6f826cca9ab79..81ddec8c5dab9f60ae0f70f5468c169f164f0824 100644 (file)
@@ -110,7 +110,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   httpDecode64_2(temp, &templen, argv[2]);
 
   if (!strncmp(temp, "mailto:", 7))
-    strlcpy(mailtoReplyTo, temp + 7, sizeof(mailtoReplyTo));
+    cupsCopyString(mailtoReplyTo, temp + 7, sizeof(mailtoReplyTo));
   else if (temp[0])
     fprintf(stderr, "WARNING: Bad notify-user-data value (%d bytes) ignored!\n",
             templen);
@@ -393,12 +393,12 @@ load_configuration(void)
   mailtoCc[0] = '\0';
 
   if ((server_admin = getenv("SERVER_ADMIN")) != NULL)
-    strlcpy(mailtoFrom, server_admin, sizeof(mailtoFrom));
+    cupsCopyString(mailtoFrom, server_admin, sizeof(mailtoFrom));
   else
     snprintf(mailtoFrom, sizeof(mailtoFrom), "root@%s",
              httpGetHostname(NULL, line, sizeof(line)));
 
-  strlcpy(mailtoSendmail, "/usr/sbin/sendmail", sizeof(mailtoSendmail));
+  cupsCopyString(mailtoSendmail, "/usr/sbin/sendmail", sizeof(mailtoSendmail));
 
   mailtoSMTPServer[0] = '\0';
 
@@ -438,21 +438,21 @@ load_configuration(void)
     }
 
     if (!_cups_strcasecmp(line, "Cc"))
-      strlcpy(mailtoCc, value, sizeof(mailtoCc));
+      cupsCopyString(mailtoCc, value, sizeof(mailtoCc));
     else if (!_cups_strcasecmp(line, "From"))
-      strlcpy(mailtoFrom, value, sizeof(mailtoFrom));
+      cupsCopyString(mailtoFrom, value, sizeof(mailtoFrom));
     else if (!_cups_strcasecmp(line, "Sendmail"))
     {
-      strlcpy(mailtoSendmail, value, sizeof(mailtoSendmail));
+      cupsCopyString(mailtoSendmail, value, sizeof(mailtoSendmail));
       mailtoSMTPServer[0] = '\0';
     }
     else if (!_cups_strcasecmp(line, "SMTPServer"))
     {
       mailtoSendmail[0] = '\0';
-      strlcpy(mailtoSMTPServer, value, sizeof(mailtoSMTPServer));
+      cupsCopyString(mailtoSMTPServer, value, sizeof(mailtoSMTPServer));
     }
     else if (!_cups_strcasecmp(line, "Subject"))
-      strlcpy(mailtoSubject, value, sizeof(mailtoSubject));
+      cupsCopyString(mailtoSubject, value, sizeof(mailtoSubject));
     else
     {
       fprintf(stderr,
@@ -491,7 +491,7 @@ pipe_sendmail(const char *to)               /* I - To: address */
   * First break the mailtoSendmail string into arguments...
   */
 
-  strlcpy(line, mailtoSendmail, sizeof(line));
+  cupsCopyString(line, mailtoSendmail, sizeof(line));
   argv[0] = line;
   argc    = 1;
 
index 1672acce7dc1f94c24b0b8197fd738f031aaddcd..1472356a93a6e752dc317aac416a7320bb84a81f 100644 (file)
@@ -182,7 +182,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       return (1);
     }
 
-    strlcpy(newname, filename, sizeof(newname));
+    cupsCopyString(newname, filename, sizeof(newname));
 
     httpAssembleURI(HTTP_URI_CODING_ALL, baseurl, sizeof(baseurl), "http",
                     NULL, host, port, resource);
index 1788d0d37d02390838ae727378c8e7e1f261ac99..660d64d8a66cb72901fa6ef1232124c10ba39e39 100644 (file)
@@ -132,7 +132,7 @@ ppdcCatalog::ppdcCatalog(const char *l,     // I - Locale
       char     baseloc[3];             // Base locale...
 
 
-      strlcpy(baseloc, l, sizeof(baseloc));
+      cupsCopyString(baseloc, l, sizeof(baseloc));
       snprintf(pofile, sizeof(pofile), "%s/%s/cups_%s.po", cg->localedir,
                baseloc, baseloc);
 
@@ -449,7 +449,7 @@ ppdcCatalog::load_messages(
        if (haveid && havestr)
          add_message(id, str);
 
-       strlcpy(id, ptr, sizeof(id));
+       cupsCopyString(id, ptr, sizeof(id));
        str[0] = '\0';
        haveid  = 1;
        havestr = 0;
@@ -467,14 +467,14 @@ ppdcCatalog::load_messages(
          return (-1);
        }
 
-       strlcpy(str, ptr, sizeof(str));
+       cupsCopyString(str, ptr, sizeof(str));
        havestr = 1;
        which   = 2;
       }
       else if (line[0] == '\"' && which == 2)
-       strlcat(str, ptr, sizeof(str));
+       cupsConcatString(str, ptr, sizeof(str));
       else if (line[0] == '\"' && which == 1)
-       strlcat(id, ptr, sizeof(id));
+       cupsConcatString(id, ptr, sizeof(id));
       else
       {
        _cupsLangPrintf(stderr, _("ppdc: Unexpected text on line %d of %s."),
index d12d0c244e9ae652ddae52d3c83d7e09a9f2a6d0..efb328f775a5881d3a5721267844674c5b7fdce6 100644 (file)
@@ -133,7 +133,7 @@ ppdcSource::import_ppd(const char *f)       // I - Filename
 
   for (i = 0; i < ppd->num_filters; i ++)
   {
-    strlcpy(line, ppd->filters[i], sizeof(line));
+    cupsCopyString(line, ppd->filters[i], sizeof(line));
 
     for (ptr = line; *ptr; ptr ++)
       if (isspace(*ptr & 255))
index e1657c6b04c6f0ff56906a95aa2b7f810473d37e..4433925158c4ad0b68f6d3efde208cf92a947e6a 100644 (file)
@@ -170,7 +170,7 @@ ppdcSource::find_include(
   if (*f == '<')
   {
     // Remove the surrounding <> from the name...
-    strlcpy(temp, f + 1, sizeof(temp));
+    cupsCopyString(temp, f + 1, sizeof(temp));
     ptr = temp + strlen(temp) - 1;
 
     if (*ptr != '>')
@@ -189,7 +189,7 @@ ppdcSource::find_include(
     if (base && *base && f[0] != '/')
       snprintf(n, (size_t)nlen, "%s/%s", base, f);
     else
-      strlcpy(n, f, (size_t)nlen);
+      cupsCopyString(n, f, (size_t)nlen);
 
     if (!access(n, 0))
       return (n);
@@ -895,7 +895,7 @@ ppdcSource::get_filter(ppdcFile *fp)        // I - File to read
     while (isspace(*ptr))
       ptr ++;
 
-    strlcpy(program, ptr, sizeof(program));
+    cupsCopyString(program, ptr, sizeof(program));
   }
   else
   {
@@ -1653,12 +1653,12 @@ ppdcSource::get_po(ppdcFile *fp)        // I - File to read
   }
 
   // Figure out the current directory...
-  strlcpy(basedir, fp->filename, sizeof(basedir));
+  cupsCopyString(basedir, fp->filename, sizeof(basedir));
 
   if ((baseptr = strrchr(basedir, '/')) != NULL)
     *baseptr = '\0';
   else
-    strlcpy(basedir, ".", sizeof(basedir));
+    cupsCopyString(basedir, ".", sizeof(basedir));
 
   // Find the po file...
   pofilename[0] = '\0';
@@ -1998,7 +1998,7 @@ ppdcSource::get_token(ppdcFile *fp,       // I - File to read
        var = find_variable(name);
        if (var)
        {
-         strlcpy(bufptr, var->value->value, (size_t)(bufend - bufptr + 1));
+         cupsCopyString(bufptr, var->value->value, (size_t)(bufend - bufptr + 1));
          bufptr += strlen(bufptr);
        }
        else
@@ -2578,12 +2578,12 @@ ppdcSource::scan_file(ppdcFile   *fp,   // I - File to read
         continue;
 
       // Figure out the current directory...
-      strlcpy(basedir, fp->filename, sizeof(basedir));
+      cupsCopyString(basedir, fp->filename, sizeof(basedir));
 
       if ((baseptr = strrchr(basedir, '/')) != NULL)
        *baseptr = '\0';
       else
-       strlcpy(basedir, ".", sizeof(basedir));
+       cupsCopyString(basedir, ".", sizeof(basedir));
 
       // Find the include file...
       if (find_include(inctemp, basedir, incname, sizeof(incname)))
index 385f456413ed4c7b5354610db3a5b05545a10d62..91a1d3143ecdbb91241fa2a2310bfb194ee7173f 100644 (file)
@@ -155,7 +155,7 @@ main(int  argc,                             // I - Number of command-line arguments
 
                locales = new ppdcArray();
 
-               strlcpy(temp, argv[i], sizeof(temp));
+               cupsCopyString(temp, argv[i], sizeof(temp));
                for (start = temp; *start; start = end)
                {
                  if ((end = strchr(start, ',')) != NULL)
@@ -339,7 +339,7 @@ main(int  argc,                             // I - Number of command-line arguments
        else
        {
          // Leave PCFileName as-is...
-         strlcpy(pcfilename, outname, sizeof(pcfilename));
+         cupsCopyString(pcfilename, outname, sizeof(pcfilename));
        }
 
        // Open the PPD file for writing...
index cd83964fae12ba5be68d15fff4ea34e09833a5d1..7788143e7ff7f21cab39b170600be1502de30d5a 100644 (file)
@@ -334,7 +334,7 @@ ppd_locale(ppd_file_t *ppd)         // I - PPD file
         snprintf(locale, sizeof(locale), "%s_%s", languages[i].language,
                 ppd->lang_version + vlen + 1);
       else
-        strlcpy(locale, languages[i].language, sizeof(locale));
+        cupsCopyString(locale, languages[i].language, sizeof(locale));
 
       return (locale);
     }
index 7353d823275b2d1cca2d8c0610e790408a407013..9b53869070b65f81557eca46608af7d91d845814 100644 (file)
@@ -205,7 +205,7 @@ cupsdAddNameMask(cups_array_t **masks,      /* IO - Masks array (created as needed) *
     * Deny *interface*...
     */
 
-    strlcpy(ifname, name + 4, sizeof(ifname));
+    cupsCopyString(ifname, name + 4, sizeof(ifname));
 
     ifptr = ifname + strlen(ifname) - 1;
 
@@ -357,7 +357,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
       if (authinfo->count == 1 && authinfo->items[0].value &&
           authinfo->items[0].valueLength >= 2)
       {
-        strlcpy(username, authinfo->items[0].value, sizeof(username));
+        cupsCopyString(username, authinfo->items[0].value, sizeof(username));
 
         cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using AuthRef.", username);
       }
@@ -389,7 +389,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
         return;
       }
 
-      strlcpy(username, pwd->pw_name, sizeof(username));
+      cupsCopyString(username, pwd->pw_name, sizeof(username));
 
       cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using AuthRef + PeerCred.", username);
     }
@@ -471,7 +471,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
       return;
     }
 
-    strlcpy(username, authorization + 9, sizeof(username));
+    cupsCopyString(username, authorization + 9, sizeof(username));
 
 #  ifdef HAVE_GSSAPI
     con->gss_uid = CUPSD_UCRED_UID(peercred);
@@ -499,7 +499,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
       return;
     }
 
-    strlcpy(username, localuser->username, sizeof(username));
+    cupsCopyString(username, localuser->username, sizeof(username));
     con->type = localuser->type;
 
     cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as %s using Local.", username);
@@ -552,7 +552,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
       return;
     }
 
-    strlcpy(password, ptr, sizeof(password));
+    cupsCopyString(password, ptr, sizeof(password));
 
    /*
     * Validate the username and password...
@@ -572,8 +572,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
       cupsd_authdata_t data;           /* Authentication data */
 
 
-      strlcpy(data.username, username, sizeof(data.username));
-      strlcpy(data.password, password, sizeof(data.password));
+      cupsCopyString(data.username, username, sizeof(data.username));
+      cupsCopyString(data.password, password, sizeof(data.password));
 
 #  ifdef __sun
       pamdata.conv        = (int (*)(int, struct pam_message **,
@@ -815,7 +815,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
        return;
       }
 
-      strlcpy(username, output_token.value, sizeof(username));
+      cupsCopyString(username, output_token.value, sizeof(username));
 
       cupsdLogClient(con, CUPSD_LOG_DEBUG, "Authorized as \"%s\" using Negotiate.", username);
 
@@ -864,7 +864,7 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
 
 
     if (sscanf(authorization, "%255s", scheme) != 1)
-      strlcpy(scheme, "UNKNOWN", sizeof(scheme));
+      cupsCopyString(scheme, "UNKNOWN", sizeof(scheme));
 
     cupsdLogClient(con, CUPSD_LOG_ERROR, "Bad authentication data \"%s ...\".", scheme);
     return;
@@ -876,8 +876,8 @@ cupsdAuthorize(cupsd_client_t *con) /* I - Client connection */
   * data and return...
   */
 
-  strlcpy(con->username, username, sizeof(con->username));
-  strlcpy(con->password, password, sizeof(con->password));
+  cupsCopyString(con->username, username, sizeof(con->username));
+  cupsCopyString(con->password, password, sizeof(con->password));
 }
 
 
@@ -1409,7 +1409,7 @@ cupsdFindBest(const char   *path, /* I - Resource path */
   * URIs...
   */
 
-  strlcpy(uri, path, sizeof(uri));
+  cupsCopyString(uri, path, sizeof(uri));
 
   if ((uriptr = strchr(uri, '?')) != NULL)
     *uriptr = '\0';            /* Drop trailing query string */
@@ -1671,7 +1671,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
       cupsdLogMessage(CUPSD_LOG_DEBUG,
                       "cupsdIsAuthorized: requesting-user-name=\"%s\"",
                       attr->values[0].string.text);
-      strlcpy(username, attr->values[0].string.text, sizeof(username));
+      cupsCopyString(username, attr->values[0].string.text, sizeof(username));
     }
     else if (best->satisfy == CUPSD_AUTH_SATISFY_ALL || auth == CUPSD_AUTH_DENY)
       return (HTTP_STATUS_UNAUTHORIZED);       /* Non-anonymous needs user/pass */
@@ -1708,7 +1708,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
       return (HTTP_STATUS_UNAUTHORIZED);
     }
 
-    strlcpy(username, con->username, sizeof(username));
+    cupsCopyString(username, con->username, sizeof(username));
   }
 
  /*
@@ -1725,7 +1725,7 @@ cupsdIsAuthorized(cupsd_client_t *con,    /* I - Connection */
 
   if (owner)
   {
-    strlcpy(ownername, owner, sizeof(ownername));
+    cupsCopyString(ownername, owner, sizeof(ownername));
 
     if ((ptr = strchr(ownername, '@')) != NULL)
       *ptr = '\0';
index 8f3829c22c5cb6c9e423e3da2b8a035942ff5cd3..16e57eb3c488d43d71f927e0c488e384471ea7c5 100644 (file)
@@ -61,7 +61,7 @@ cupsdAddCert(int        pid,          /* I - Process ID */
 
   cert->pid  = pid;
   cert->type = type;
-  strlcpy(cert->username, username, sizeof(cert->username));
+  cupsCopyString(cert->username, username, sizeof(cert->username));
 
   for (i = 0; i < 32; i ++)
     cert->certificate[i] = hex[CUPS_RAND() & 15];
index 8e24f9ba4187d301bf5f1b8be0c47cfb0d21d670..ace5bee232e940a6b44d0d01ee9f2772b5a2d291 100644 (file)
@@ -464,7 +464,7 @@ cupsdLoadAllClasses(void)
       */
 
       if (value)
-       strlcpy(p->state_message, value, sizeof(p->state_message));
+       cupsCopyString(p->state_message, value, sizeof(p->state_message));
     }
     else if (!_cups_strcasecmp(line, "StateTime"))
     {
@@ -719,7 +719,7 @@ cupsdSaveAllClasses(void)
       switch (pclass->num_auth_info_required)
       {
         case 1 :
-            strlcpy(value, pclass->auth_info_required[0], sizeof(value));
+            cupsCopyString(value, pclass->auth_info_required[0], sizeof(value));
            break;
 
         case 2 :
index ff922430d8c05ec70a79fcc65b4d02186b0a3ecd..1e70a17ce1b72371994f19c74578265f8cd78406 100644 (file)
@@ -306,20 +306,20 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
     cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to get local address - %s",
                    strerror(errno));
 
-    strlcpy(con->servername, "localhost", sizeof(con->servername));
+    cupsCopyString(con->servername, "localhost", sizeof(con->servername));
     con->serverport = LocalPort;
   }
 #ifdef AF_LOCAL
   else if (httpAddrGetFamily(&temp) == AF_LOCAL)
   {
-    strlcpy(con->servername, "localhost", sizeof(con->servername));
+    cupsCopyString(con->servername, "localhost", sizeof(con->servername));
     con->serverport = LocalPort;
   }
 #endif /* AF_LOCAL */
   else
   {
     if (httpAddrIsLocalhost(&temp))
-      strlcpy(con->servername, "localhost", sizeof(con->servername));
+      cupsCopyString(con->servername, "localhost", sizeof(con->servername));
     else if (HostNameLookups)
       httpAddrLookup(&temp, con->servername, sizeof(con->servername));
     else
@@ -732,7 +732,7 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
          * con->uri are HTTP_MAX_URI bytes in size...
          */
 
-          strlcpy(con->uri, resource, sizeof(con->uri));
+          cupsCopyString(con->uri, resource, sizeof(con->uri));
        }
 
        /*
@@ -1067,7 +1067,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
              else
               {
                if (type == NULL)
-                 strlcpy(line, "text/plain", sizeof(line));
+                 cupsCopyString(line, "text/plain", sizeof(line));
                else
                  snprintf(line, sizeof(line), "%s/%s", type->super, type->type);
 
@@ -1405,7 +1405,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
 
                type = mimeFileType(MimeDatabase, filename, NULL, NULL);
                if (type == NULL)
-                 strlcpy(line, "text/plain", sizeof(line));
+                 cupsCopyString(line, "text/plain", sizeof(line));
                else
                  snprintf(line, sizeof(line), "%s/%s", type->super, type->type);
 
@@ -1925,7 +1925,7 @@ cupsdSendError(cupsd_client_t *con,       /* I - Connection */
   * never disable it in that case.
   */
 
-  strlcpy(location, httpGetField(con->http, HTTP_FIELD_LOCATION), sizeof(location));
+  cupsCopyString(location, httpGetField(con->http, HTTP_FIELD_LOCATION), sizeof(location));
 
   httpClearFields(con->http);
   httpClearCookie(con->http);
@@ -2083,11 +2083,11 @@ cupsdSendHeader(
 
     if (auth_type == CUPSD_AUTH_BASIC)
     {
-      strlcpy(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str));
+      cupsCopyString(auth_str, "Basic realm=\"CUPS\"", sizeof(auth_str));
     }
     else if (auth_type == CUPSD_AUTH_NEGOTIATE)
     {
-      strlcpy(auth_str, "Negotiate", sizeof(auth_str));
+      cupsCopyString(auth_str, "Negotiate", sizeof(auth_str));
     }
 
     if (con->best && !con->is_browser && !_cups_strcasecmp(httpGetHostname(con->http, NULL, 0), "localhost"))
@@ -2112,7 +2112,7 @@ cupsdSendHeader(
 #if defined(SO_PEERCRED) && defined(AF_LOCAL)
       if (httpAddrGetFamily(httpGetAddress(con->http)) == AF_LOCAL)
       {
-        strlcpy(auth_key, ", PeerCred", auth_size);
+        cupsCopyString(auth_key, ", PeerCred", auth_size);
         auth_key += 10;
         auth_size -= 10;
       }
@@ -2141,14 +2141,14 @@ cupsdSendHeader(
            snprintf(auth_key, auth_size, ", AuthRef key=\"%s\", Local trc=\"y\"", SystemGroupAuthKey);
           else
 #endif /* HAVE_AUTHORIZATION_H */
-         strlcpy(auth_key, ", Local trc=\"y\"", auth_size);
+         cupsCopyString(auth_key, ", Local trc=\"y\"", auth_size);
          need_local = 0;
          break;
        }
       }
 
       if (need_local)
-       strlcat(auth_key, ", Local", auth_size);
+       cupsConcatString(auth_key, ", Local", auth_size);
     }
 
     if (auth_str[0])
@@ -2685,12 +2685,12 @@ get_file(cupsd_client_t *con,           /* I  - Client connection */
   }
   else if ((!strncmp(con->uri, "/ppd/", 5) || !strncmp(con->uri, "/printers/", 10) || !strncmp(con->uri, "/classes/", 9)) && !strcmp(con->uri + strlen(con->uri) - 4, ".ppd"))
   {
-    strlcpy(dest, strchr(con->uri + 1, '/') + 1, sizeof(dest));
+    cupsCopyString(dest, strchr(con->uri + 1, '/') + 1, sizeof(dest));
     dest[strlen(dest) - 4] = '\0'; /* Strip .ppd */
 
     if ((p = cupsdFindDest(dest)) == NULL)
     {
-      strlcpy(filename, "/", len);
+      cupsCopyString(filename, "/", len);
       cupsdLogClient(con, CUPSD_LOG_INFO, "No destination \"%s\" found.", dest);
       return (NULL);
     }
@@ -2722,12 +2722,12 @@ get_file(cupsd_client_t *con,           /* I  - Client connection */
   }
   else if ((!strncmp(con->uri, "/icons/", 7) || !strncmp(con->uri, "/printers/", 10) || !strncmp(con->uri, "/classes/", 9)) && !strcmp(con->uri + strlen(con->uri) - 4, ".png"))
   {
-    strlcpy(dest, strchr(con->uri + 1, '/') + 1, sizeof(dest));
+    cupsCopyString(dest, strchr(con->uri + 1, '/') + 1, sizeof(dest));
     dest[strlen(dest) - 4] = '\0'; /* Strip .png */
 
     if ((p = cupsdFindDest(dest)) == NULL)
     {
-      strlcpy(filename, "/", len);
+      cupsCopyString(filename, "/", len);
       cupsdLogClient(con, CUPSD_LOG_INFO, "No destination \"%s\" found.", dest);
       return (NULL);
     }
@@ -2762,18 +2762,18 @@ get_file(cupsd_client_t *con,           /* I  - Client connection */
   }
   else if (!strcmp(con->uri, "/admin/conf/cupsd.conf"))
   {
-    strlcpy(filename, ConfigurationFile, len);
+    cupsCopyString(filename, ConfigurationFile, len);
 
     perm_check = 0;
   }
   else if (!strncmp(con->uri, "/admin/log/", 11))
   {
     if (!strncmp(con->uri + 11, "access_log", 10) && AccessLog[0] == '/')
-      strlcpy(filename, AccessLog, len);
+      cupsCopyString(filename, AccessLog, len);
     else if (!strncmp(con->uri + 11, "error_log", 9) && ErrorLog[0] == '/')
-      strlcpy(filename, ErrorLog, len);
+      cupsCopyString(filename, ErrorLog, len);
     else if (!strncmp(con->uri + 11, "page_log", 8) && PageLog[0] == '/')
-      strlcpy(filename, PageLog, len);
+      cupsCopyString(filename, PageLog, len);
     else
       return (NULL);
 
@@ -2791,24 +2791,24 @@ get_file(cupsd_client_t *con,           /* I  - Client connection */
     snprintf(filename, len, "%s/rss/%s", CacheDir, con->uri + 5);
   else if (!strncmp(con->uri, "/strings/", 9) && !strcmp(con->uri + strlen(con->uri) - 8, ".strings"))
   {
-    strlcpy(dest, con->uri + 9, sizeof(dest));
+    cupsCopyString(dest, con->uri + 9, sizeof(dest));
     dest[strlen(dest) - 8] = '\0';
 
     if ((p = cupsdFindDest(dest)) == NULL)
     {
-      strlcpy(filename, "/", len);
+      cupsCopyString(filename, "/", len);
       cupsdLogClient(con, CUPSD_LOG_INFO, "No destination \"%s\" found.", dest);
       return (NULL);
     }
 
     if (!p->strings)
     {
-      strlcpy(filename, "/", len);
+      cupsCopyString(filename, "/", len);
       cupsdLogClient(con, CUPSD_LOG_INFO, "No strings files for \"%s\".", dest);
       return (NULL);
     }
 
-    strlcpy(filename, p->strings, len);
+    cupsCopyString(filename, p->strings, len);
 
     perm_check = 0;
   }
@@ -2894,7 +2894,7 @@ get_file(cupsd_client_t *con,             /* I  - Client connection */
     */
 
     if (con->uri[strlen(con->uri) - 1] != '/')
-      strlcat(con->uri, "/", sizeof(con->uri));
+      cupsConcatString(con->uri, "/", sizeof(con->uri));
 
    /*
     * Find the directory index file, trying every language...
@@ -2926,7 +2926,7 @@ get_file(cupsd_client_t *con,             /* I  - Client connection */
       ptr  = filename + strlen(filename);
       plen = len - (size_t)(ptr - filename);
 
-      strlcpy(ptr, "index.html", plen);
+      cupsCopyString(ptr, "index.html", plen);
       status = lstat(filename, filestats);
     }
     while (status && language[0]);
@@ -3222,7 +3222,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
   argv[0] = command;
 
   if (options)
-    strlcpy(argbuf, options, sizeof(argbuf));
+    cupsCopyString(argbuf, options, sizeof(argbuf));
   else
     argbuf[0] = '\0';
 
@@ -3340,9 +3340,9 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */
   else if (con->language)
     snprintf(lang, sizeof(lang), "LANG=%s.UTF8", con->language->language);
   else
-    strlcpy(lang, "LANG=C", sizeof(lang));
+    cupsCopyString(lang, "LANG=C", sizeof(lang));
 
-  strlcpy(remote_addr, "REMOTE_ADDR=", sizeof(remote_addr));
+  cupsCopyString(remote_addr, "REMOTE_ADDR=", sizeof(remote_addr));
   httpAddrGetString(httpGetAddress(con->http), remote_addr + 12,
                  sizeof(remote_addr) - 12);
 
@@ -3537,7 +3537,7 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   * Copy the Host: header for later use...
   */
 
-  strlcpy(con->clientname, httpGetField(con->http, HTTP_FIELD_HOST),
+  cupsCopyString(con->clientname, httpGetField(con->http, HTTP_FIELD_HOST),
           sizeof(con->clientname));
   if ((ptr = strrchr(con->clientname, ':')) != NULL && !strchr(ptr, ']'))
   {
index 809ed7c65ddfc1a3f85977f359d4dd681c89aa09..60293df22015bcd26e8b22371f97055188ae06cf 100644 (file)
@@ -388,7 +388,7 @@ apple_register_profiles(
        snprintf(iccfile, sizeof(iccfile), "%s/profiles/%s", DataDir,
                 attr->value);
       else
-       strlcpy(iccfile, attr->value, sizeof(iccfile));
+       cupsCopyString(iccfile, attr->value, sizeof(iccfile));
 
       if (access(iccfile, 0))
       {
@@ -488,7 +488,7 @@ apple_register_profiles(
          snprintf(iccfile, sizeof(iccfile), "%s/profiles/%s", DataDir,
                   attr->value);
         else
-         strlcpy(iccfile, attr->value, sizeof(iccfile));
+         cupsCopyString(iccfile, attr->value, sizeof(iccfile));
 
         if (_cupsFileCheck(iccfile, _CUPS_FILE_CHECK_FILE, !RunUser,
                           cupsdLogFCMessage, p))
@@ -1409,7 +1409,7 @@ colord_register_printer(
         snprintf(iccfile, sizeof(iccfile), "%s/profiles/%s", DataDir,
                  attr->value);
       else
-        strlcpy(iccfile, attr->value, sizeof(iccfile));
+        cupsCopyString(iccfile, attr->value, sizeof(iccfile));
 
       if (_cupsFileCheck(iccfile, _CUPS_FILE_CHECK_FILE, !RunUser,
                         cupsdLogFCMessage, p))
index 3adfff141ea8e8fff65e3e3585522dd364f325e2..b6cd419e03d38d98c00be713dd12c59c0b429d40 100644 (file)
@@ -591,7 +591,7 @@ cupsdReadConfiguration(void)
   else
     PrintcapFormat = PRINTCAP_BSD;
 
-  strlcpy(temp, ConfigurationFile, sizeof(temp));
+  cupsCopyString(temp, ConfigurationFile, sizeof(temp));
   if ((slash = strrchr(temp, '/')) != NULL)
     *slash = '\0';
 
@@ -866,7 +866,7 @@ cupsdReadConfiguration(void)
     {
       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get hostname: %s",
                       strerror(errno));
-      strlcpy(temp, "localhost", sizeof(temp));
+      cupsCopyString(temp, "localhost", sizeof(temp));
     }
 
     cupsdSetString(&ServerName, temp);
@@ -1735,7 +1735,7 @@ get_address(const char  *value,           /* I - Value string */
   * is only digits, then we have a port number by itself...
   */
 
-  strlcpy(buffer, value, sizeof(buffer));
+  cupsCopyString(buffer, value, sizeof(buffer));
 
   if ((portname = strrchr(buffer, ':')) != NULL && !strchr(portname, ']'))
   {
@@ -2454,7 +2454,7 @@ parse_fatal_errors(const char *s) /* I - FatalErrors string */
   * Loop through the value string,...
   */
 
-  strlcpy(value, s, sizeof(value));
+  cupsCopyString(value, s, sizeof(value));
 
   fatal = CUPSD_FATAL_NONE;
 
@@ -2530,7 +2530,7 @@ parse_groups(const char *s,               /* I - Space-delimited groups */
   * Make a copy of the string and parse out the groups...
   */
 
-  strlcpy(value, s, sizeof(value));
+  cupsCopyString(value, s, sizeof(value));
 
   status   = 1;
   valstart = value;
@@ -2617,7 +2617,7 @@ parse_protocols(const char *s)            /* I - Space-delimited protocols */
   * Loop through the value string,...
   */
 
-  strlcpy(value, s, sizeof(value));
+  cupsCopyString(value, s, sizeof(value));
 
   protocols = 0;
 
@@ -2900,7 +2900,7 @@ parse_variable(
        }
 
        if (value[0] == '/')
-         strlcpy(temp, value, sizeof(temp));
+         cupsCopyString(temp, value, sizeof(temp));
        else
          snprintf(temp, sizeof(temp), "%s/%s", ServerRoot, value);
 
index cc094d856109c806af1d22cfee47b10c95b31820..20d174dc49742e0667adb77873f93d026e2ec02e 100644 (file)
@@ -361,9 +361,9 @@ add_device(
   * Copy the strings over...
   */
 
-  strlcpy(device->device_class, device_class, sizeof(device->device_class));
-  strlcpy(device->device_info, device_info, sizeof(device->device_info));
-  strlcpy(device->device_uri, device_uri, sizeof(device->device_uri));
+  cupsCopyString(device->device_class, device_class, sizeof(device->device_class));
+  cupsCopyString(device->device_info, device_info, sizeof(device->device_info));
+  cupsCopyString(device->device_uri, device_uri, sizeof(device->device_uri));
 
  /*
   * Add the device to the array and return...
@@ -480,7 +480,7 @@ get_device(cupsd_backend_t *backend)        /* I - Backend to read from */
     *   class URI "make model" "name" ["1284 device ID"] ["location"]
     */
 
-    strlcpy(temp, line, sizeof(temp));
+    cupsCopyString(temp, line, sizeof(temp));
 
    /*
     * device-class
index 4550dbf6dc1637cda4a292037247e85b42c13993..eb59e6464c26ac087ae138e41dc672e8d91d8ae4 100644 (file)
@@ -266,18 +266,18 @@ add_ppd(const char *filename,             /* I - PPD filename */
   ppd->record.model_number = model_number;
   ppd->record.type         = type;
 
-  strlcpy(ppd->record.filename, filename, sizeof(ppd->record.filename));
-  strlcpy(ppd->record.name, name, sizeof(ppd->record.name));
-  strlcpy(ppd->record.languages[0], language,
+  cupsCopyString(ppd->record.filename, filename, sizeof(ppd->record.filename));
+  cupsCopyString(ppd->record.name, name, sizeof(ppd->record.name));
+  cupsCopyString(ppd->record.languages[0], language,
           sizeof(ppd->record.languages[0]));
-  strlcpy(ppd->record.products[0], product, sizeof(ppd->record.products[0]));
-  strlcpy(ppd->record.psversions[0], psversion,
+  cupsCopyString(ppd->record.products[0], product, sizeof(ppd->record.products[0]));
+  cupsCopyString(ppd->record.psversions[0], psversion,
           sizeof(ppd->record.psversions[0]));
-  strlcpy(ppd->record.make, make, sizeof(ppd->record.make));
-  strlcpy(ppd->record.make_and_model, make_and_model,
+  cupsCopyString(ppd->record.make, make, sizeof(ppd->record.make));
+  cupsCopyString(ppd->record.make_and_model, make_and_model,
           sizeof(ppd->record.make_and_model));
-  strlcpy(ppd->record.device_id, device_id, sizeof(ppd->record.device_id));
-  strlcpy(ppd->record.scheme, scheme, sizeof(ppd->record.scheme));
+  cupsCopyString(ppd->record.device_id, device_id, sizeof(ppd->record.device_id));
+  cupsCopyString(ppd->record.scheme, scheme, sizeof(ppd->record.scheme));
 
  /*
   * Strip confusing (and often wrong) "recommended" suffix added by
@@ -445,7 +445,7 @@ cat_ppd(const char *name,           /* I - PPD name */
     exit(1);
   }
 
-  strlcpy(scheme, name, sizeof(scheme));
+  cupsCopyString(scheme, name, sizeof(scheme));
   if ((sptr = strchr(scheme, ':')) != NULL)
   {
     *sptr = '\0';
@@ -790,7 +790,7 @@ dump_ppds_dat(const char *filename) /* I - Filename */
   */
 
   if (filename)
-    strlcpy(temp, filename, sizeof(temp));
+    cupsCopyString(temp, filename, sizeof(temp));
   else
     temp[0] = '\0';
 
@@ -1648,7 +1648,7 @@ load_drv(const char  *filename,           /* I - Actual filename */
     nick_name  = d->find_attr("NickName", NULL);
 
     if (nick_name)
-      strlcpy(make_model, nick_name->value->value, sizeof(make_model));
+      cupsCopyString(make_model, nick_name->value->value, sizeof(make_model));
     else if (_cups_strncasecmp(d->model_name->value, d->manufacturer->value,
                          strlen(d->manufacturer->value)))
       snprintf(make_model, sizeof(make_model), "%s %s, %s",
@@ -1688,7 +1688,7 @@ load_drv(const char  *filename,           /* I - Actual filename */
          ppd = add_ppd(name, uri, "en", d->manufacturer->value, make_model, device_id ? device_id->value->value : "", product->value->value,
                        ps_version ? ps_version->value->value : "(3010) 0", mtime, (size_t)size, d->model_number, type, "drv");
        else if (products_found < PPD_MAX_PROD)
-         strlcpy(ppd->record.products[products_found], product->value->value, sizeof(ppd->record.products[0]));
+         cupsCopyString(ppd->record.products[products_found], product->value->value, sizeof(ppd->record.products[0]));
        else
          break;
 
@@ -1858,7 +1858,7 @@ load_drivers(cups_array_t *include,       /* I - Drivers to include */
         device_id[0] = '\0';
        product[0]   = '\0';
        psversion[0] = '\0';
-       strlcpy(type_str, "postscript", sizeof(type_str));
+       cupsCopyString(type_str, "postscript", sizeof(type_str));
 
         if (sscanf(line, "\"%255[^\"]\"%127s%*[ \t]\"%127[^\"]\""
                         "%*[ \t]\"%127[^\"]\"%*[ \t]\"%255[^\"]\""
@@ -1920,7 +1920,7 @@ load_drivers(cups_array_t *include,       /* I - Drivers to include */
              else
                ptr = start + strlen(start);
 
-              strlcpy(ppd->record.languages[i], start,
+              cupsCopyString(ppd->record.languages[i], start,
                      sizeof(ppd->record.languages[0]));
 
              start = ptr;
@@ -2023,7 +2023,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
   manufacturer[0]  = '\0';
   device_id[0]     = '\0';
   lang_encoding[0] = '\0';
-  strlcpy(lang_version, "en", sizeof(lang_version));
+  cupsCopyString(lang_version, "en", sizeof(lang_version));
   model_number     = 0;
   install_group    = 0;
   type             = PPD_TYPE_POSTSCRIPT;
@@ -2047,7 +2047,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
 
       // Make sure device ID ends with a semicolon...
       if (device_id[0] && device_id[strlen(device_id) - 1] != ';')
-       strlcat(device_id, ";", sizeof(device_id));
+       cupsConcatString(device_id, ";", sizeof(device_id));
     }
     else if (!strncmp(line, "*Product:", 9))
     {
@@ -2146,7 +2146,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
     cupsCharsetToUTF8((cups_utf8_t *)make_model, nick_name,
                      sizeof(make_model), _ppdGetEncoding(lang_encoding));
   else
-    strlcpy(make_model, model_name, sizeof(make_model));
+    cupsCopyString(make_model, model_name, sizeof(make_model));
 
   while (isspace(make_model[0] & 255))
     _cups_strcpy(make_model, make_model + 1);
@@ -2186,7 +2186,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
     _cups_strcpy(manufacturer, manufacturer + 1);
 
   if (!_cups_strncasecmp(make_model, manufacturer, strlen(manufacturer)))
-    strlcpy(temp, make_model, sizeof(temp));
+    cupsCopyString(temp, make_model, sizeof(temp));
   else
     snprintf(temp, sizeof(temp), "%s %s", manufacturer, make_model);
 
@@ -2202,7 +2202,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
     * Nope, copy the first part of the make and model then...
     */
 
-    strlcpy(manufacturer, make_model, sizeof(manufacturer));
+    cupsCopyString(manufacturer, make_model, sizeof(manufacturer));
 
    /*
     * Truncate at the first space, dash, or slash, or make the
@@ -2216,13 +2216,13 @@ load_ppd(const char  *filename,         /* I - Real filename */
     if (*ptr && ptr > manufacturer)
       *ptr = '\0';
     else
-      strlcpy(manufacturer, "Other", sizeof(manufacturer));
+      cupsCopyString(manufacturer, "Other", sizeof(manufacturer));
   }
   else if (!_cups_strncasecmp(manufacturer, "LHAG", 4) ||
           !_cups_strncasecmp(manufacturer, "linotype", 8))
-    strlcpy(manufacturer, "LHAG", sizeof(manufacturer));
+    cupsCopyString(manufacturer, "LHAG", sizeof(manufacturer));
   else if (!_cups_strncasecmp(manufacturer, "Hewlett", 7))
-    strlcpy(manufacturer, "HP", sizeof(manufacturer));
+    cupsCopyString(manufacturer, "HP", sizeof(manufacturer));
 
  /*
   * Fix the lang_version as needed...
@@ -2270,7 +2270,7 @@ load_ppd(const char  *filename,           /* I - Real filename */
     * Unknown language; use "xx"...
     */
 
-    strlcpy(lang_version, "xx", sizeof(lang_version));
+    cupsCopyString(lang_version, "xx", sizeof(lang_version));
   }
 
  /*
@@ -2306,19 +2306,19 @@ load_ppd(const char  *filename,         /* I - Real filename */
     ppd->record.model_number = model_number;
     ppd->record.type         = type;
 
-    strlcpy(ppd->record.filename, name, sizeof(ppd->record.filename));
-    strlcpy(ppd->record.name, name, sizeof(ppd->record.name));
-    strlcpy(ppd->record.languages[0], lang_version,
+    cupsCopyString(ppd->record.filename, name, sizeof(ppd->record.filename));
+    cupsCopyString(ppd->record.name, name, sizeof(ppd->record.name));
+    cupsCopyString(ppd->record.languages[0], lang_version,
            sizeof(ppd->record.languages[0]));
-    strlcpy(ppd->record.products[0], (char *)cupsArrayFirst(products),
+    cupsCopyString(ppd->record.products[0], (char *)cupsArrayFirst(products),
            sizeof(ppd->record.products[0]));
-    strlcpy(ppd->record.psversions[0], (char *)cupsArrayFirst(psversions),
+    cupsCopyString(ppd->record.psversions[0], (char *)cupsArrayFirst(psversions),
            sizeof(ppd->record.psversions[0]));
-    strlcpy(ppd->record.make, manufacturer, sizeof(ppd->record.make));
-    strlcpy(ppd->record.make_and_model, make_model,
+    cupsCopyString(ppd->record.make, manufacturer, sizeof(ppd->record.make));
+    cupsCopyString(ppd->record.make_and_model, make_model,
            sizeof(ppd->record.make_and_model));
-    strlcpy(ppd->record.device_id, device_id, sizeof(ppd->record.device_id));
-    strlcpy(ppd->record.scheme, scheme, sizeof(ppd->record.scheme));
+    cupsCopyString(ppd->record.device_id, device_id, sizeof(ppd->record.device_id));
+    cupsCopyString(ppd->record.scheme, scheme, sizeof(ppd->record.scheme));
   }
 
  /*
@@ -2328,19 +2328,19 @@ load_ppd(const char  *filename,         /* I - Real filename */
   for (i = 1;
        i < PPD_MAX_PROD && (ptr = (char *)cupsArrayNext(products)) != NULL;
        i ++)
-    strlcpy(ppd->record.products[i], ptr,
+    cupsCopyString(ppd->record.products[i], ptr,
            sizeof(ppd->record.products[0]));
 
   for (i = 1;
        i < PPD_MAX_VERS && (ptr = (char *)cupsArrayNext(psversions)) != NULL;
        i ++)
-    strlcpy(ppd->record.psversions[i], ptr,
+    cupsCopyString(ppd->record.psversions[i], ptr,
            sizeof(ppd->record.psversions[0]));
 
   for (i = 1, ptr = (char *)cupsArrayFirst(cups_languages);
        i < PPD_MAX_LANG && ptr;
        i ++, ptr = (char *)cupsArrayNext(cups_languages))
-    strlcpy(ppd->record.languages[i], ptr,
+    cupsCopyString(ppd->record.languages[i], ptr,
            sizeof(ppd->record.languages[0]));
 
  /*
@@ -2447,7 +2447,7 @@ load_ppds(const char *d,          /* I - Actual directory */
     if (p[0])
       snprintf(name, sizeof(name), "%s/%s", p, dent->filename);
     else
-      strlcpy(name, dent->filename, sizeof(name));
+      cupsCopyString(name, dent->filename, sizeof(name));
 
     if (S_ISDIR(dent->fileinfo.st_mode))
     {
@@ -2474,8 +2474,8 @@ load_ppds(const char *d,          /* I - Actual directory */
                           _cupsFileCheckFilter, NULL))
          continue;
 
-       strlcat(filename, "/Contents/Resources/PPDs", sizeof(filename));
-       strlcat(name, "/Contents/Resources/PPDs", sizeof(name));
+       cupsConcatString(filename, "/Contents/Resources/PPDs", sizeof(filename));
+       cupsConcatString(name, "/Contents/Resources/PPDs", sizeof(name));
 
        load_ppds(filename, name, 0);
       }
@@ -2498,8 +2498,8 @@ load_ppds(const char *d,          /* I - Actual directory */
     * See if this file has been scanned before...
     */
 
-    strlcpy(key.record.filename, name, sizeof(key.record.filename));
-    strlcpy(key.record.name, name, sizeof(key.record.name));
+    cupsCopyString(key.record.filename, name, sizeof(key.record.filename));
+    cupsCopyString(key.record.name, name, sizeof(key.record.name));
 
     ppd = (ppd_info_t *)cupsArrayFind(PPDsByName, &key);
 
@@ -2752,7 +2752,7 @@ read_tar(cups_file_t *fp,         /* I - Archive to read */
       snprintf(name, namesize, "%s/%s", record.header.prefix,
                record.header.pathname);
     else
-      strlcpy(name, record.header.pathname, namesize);
+      cupsCopyString(name, record.header.pathname, namesize);
 
     info->st_mtime = strtol(record.header.mtime, NULL, 8);
     info->st_size  = strtoll(record.header.size, NULL, 8);
index 64885ef7d87752ee9f621d32cebf7df71dd13963..0b7ca11a6fccccc423c5524bddd894a3b66f249d 100644 (file)
@@ -197,7 +197,7 @@ main(int  argc,                             /* I - Number of command-line args */
                  if (!strcmp(command, "convert"))
                    num_options = cupsAddOption("copies", argv[i], num_options, &options);
                  else
-                   strlcpy(cupsfilesconf, argv[i], sizeof(cupsfilesconf));
+                   cupsCopyString(cupsfilesconf, argv[i], sizeof(cupsfilesconf));
                }
                else
                {
@@ -649,7 +649,7 @@ add_printer_filter(
     char filename[1024];               /* Full path to program */
 
     if (program[0] == '/')
-      strlcpy(filename, program, sizeof(filename));
+      cupsCopyString(filename, program, sizeof(filename));
     else
       snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program);
 
@@ -821,7 +821,7 @@ escape_options(
     if (sptr > s)
       *sptr++ = ' ';
 
-    strlcpy(sptr, option->name, bytes - (size_t)(sptr - s));
+    cupsCopyString(sptr, option->name, bytes - (size_t)(sptr - s));
     sptr += strlen(sptr);
     *sptr++ = '=';
 
@@ -1061,11 +1061,11 @@ exec_filters(mime_type_t   *srctype,    /* I - Source type */
   if (!access("/System/Library/Frameworks/ApplicationServices.framework/"
              "Versions/A/Frameworks/PrintCore.framework/Versions/A/"
              "Resources/English.lproj/Generic.ppd", 0))
-    strlcpy(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/"
+    cupsCopyString(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/"
                  "Versions/A/Frameworks/PrintCore.framework/Versions/A/"
                 "Resources/English.lproj/Generic.ppd", sizeof(ppd));
   else
-    strlcpy(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/"
+    cupsCopyString(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/"
                  "Versions/A/Frameworks/PrintCore.framework/Versions/A/"
                 "Resources/Generic.ppd", sizeof(ppd));
 #else
@@ -1088,14 +1088,14 @@ exec_filters(mime_type_t   *srctype,    /* I - Source type */
       snprintf(printer_location, sizeof(printer_location),
                "PRINTER_LOCATION=%s", temp);
     else
-      strlcpy(printer_location, "PRINTER_LOCATION=Unknown",
+      cupsCopyString(printer_location, "PRINTER_LOCATION=Unknown",
               sizeof(printer_location));
   }
   else
   {
     snprintf(printer_info, sizeof(printer_info), "PRINTER_INFO=%s",
              printer ? printer : "Unknown");
-    strlcpy(printer_location, "PRINTER_LOCATION=Unknown",
+    cupsCopyString(printer_location, "PRINTER_LOCATION=Unknown",
             sizeof(printer_location));
   }
 
@@ -1183,7 +1183,7 @@ exec_filters(mime_type_t   *srctype,      /* I - Source type */
     next = (mime_filter_t *)cupsArrayNext(filters);
 
     if (filter->filter[0] == '/')
-      strlcpy(program, filter->filter, sizeof(program));
+      cupsCopyString(program, filter->filter, sizeof(program));
     else
       snprintf(program, sizeof(program), "%s/filter/%s", ServerBin,
               filter->filter);
@@ -1449,7 +1449,7 @@ read_cups_files_conf(
   else
     set_string(&ServerBin, CUPS_SERVERBIN);
 
-  strlcpy(line, filename, sizeof(line));
+  cupsCopyString(line, filename, sizeof(line));
   if ((ptr = strrchr(line, '/')) != NULL)
     *ptr = '\0';
   else
index ec06cb1338082a51439f0b25d0655a77be5e0750..344c5df8382432b7a21e39278d70e7fb0fa45d8b 100644 (file)
@@ -355,7 +355,7 @@ dnssdBuildTxtRecord(
     */
 
     if ((ptr = DNSSDHostName + strlen(DNSSDHostName) - 1) >= DNSSDHostName && *ptr == '.')
-      strlcpy(admin_hostname, DNSSDHostName, sizeof(admin_hostname));
+      cupsCopyString(admin_hostname, DNSSDHostName, sizeof(admin_hostname));
     else
       snprintf(admin_hostname, sizeof(admin_hostname), "%s.", DNSSDHostName);
   }
@@ -425,7 +425,7 @@ dnssdBuildTxtRecord(
       if (ptr > urf_str && ptr < (urf_str + sizeof(urf_str) - 1))
        *ptr++ = ',';
 
-      strlcpy(ptr, value, sizeof(urf_str) - (size_t)(ptr - urf_str));
+      cupsCopyString(ptr, value, sizeof(urf_str) - (size_t)(ptr - urf_str));
       ptr += strlen(ptr);
 
       if (ptr >= (urf_str + sizeof(urf_str) - 1))
@@ -1045,7 +1045,7 @@ dnssdRegisterInstance(
   if (subtypes)
     snprintf(temp, sizeof(temp), "%s,%s", type, subtypes);
   else
-    strlcpy(temp, type, sizeof(temp));
+    cupsCopyString(temp, type, sizeof(temp));
 
   *srv  = DNSSDMaster;
   error = DNSServiceRegister(srv, kDNSServiceFlagsShareConnection,
@@ -1079,7 +1079,7 @@ dnssdRegisterInstance(
     char       *start,                 /* Start of subtype */
                subtype[256];           /* Subtype string */
 
-    strlcpy(temp, subtypes, sizeof(temp));
+    cupsCopyString(temp, subtypes, sizeof(temp));
 
     for (start = temp; *start; start = ptr)
     {
@@ -1190,15 +1190,15 @@ dnssdRegisterPrinter(
       if (DNSSDComputerName)
        snprintf(name, sizeof(name), "%s @ %s", p->info, DNSSDComputerName);
       else
-       strlcpy(name, p->info, sizeof(name));
+       cupsCopyString(name, p->info, sizeof(name));
     }
     else if (DNSSDComputerName)
       snprintf(name, sizeof(name), "%s @ %s", p->name, DNSSDComputerName);
     else
-      strlcpy(name, p->name, sizeof(name));
+      cupsCopyString(name, p->name, sizeof(name));
   }
   else
-    strlcpy(name, p->reg_name, sizeof(name));
+    cupsCopyString(name, p->reg_name, sizeof(name));
 
  /*
   * Register IPP and LPD...
@@ -1526,7 +1526,7 @@ dnssdUpdateDNSSDName(int from_callback)   /* I - Called from callback? */
     if (DNSSDComputerName)
       snprintf(webif, sizeof(webif), "CUPS @ %s", DNSSDComputerName);
     else
-      strlcpy(webif, "CUPS", sizeof(webif));
+      cupsCopyString(webif, "CUPS", sizeof(webif));
 
     dnssdDeregisterInstance(&WebIFSrv, from_callback);
     dnssdRegisterInstance(&WebIFSrv, NULL, webif, "_http._tcp", "_printer", DNSSDPort, NULL, 1, from_callback);
@@ -1565,7 +1565,7 @@ get_auth_info_required(
       if (i)
        *bufptr++ = ',';
 
-      strlcpy(bufptr, p->auth_info_required[i], bufsize - (size_t)(bufptr - buffer));
+      cupsCopyString(bufptr, p->auth_info_required[i], bufsize - (size_t)(bufptr - buffer));
       bufptr += strlen(bufptr);
     }
 
@@ -1598,11 +1598,11 @@ get_auth_info_required(
           return (NULL);
 
       case CUPSD_AUTH_NEGOTIATE :
-         strlcpy(buffer, "negotiate", bufsize);
+         cupsCopyString(buffer, "negotiate", bufsize);
          break;
 
       default :
-         strlcpy(buffer, "username,password", bufsize);
+         cupsCopyString(buffer, "username,password", bufsize);
          break;
     }
 
index d00e63b2a13cfaf25dd188cd2334e36ef0cc4856..94763a9b080dfcc14c85ad582f2a5fb15d181d9f 100644 (file)
@@ -11,6 +11,7 @@
  * Include necessary headers...
  */
 
+#include <cups/cups.h>
 #include <cups/string-private.h>
 #include "mime.h"
 
@@ -92,7 +93,7 @@ mimeAddFilter(mime_t      *mime,      /* I - MIME database */
       DEBUG_printf(("1mimeAddFilter: Replacing filter \"%s\", cost %d.",
                     temp->filter, temp->cost));
       temp->cost = cost;
-      strlcpy(temp->filter, filter, sizeof(temp->filter));
+      cupsCopyString(temp->filter, filter, sizeof(temp->filter));
     }
   }
   else
@@ -117,7 +118,7 @@ mimeAddFilter(mime_t      *mime,    /* I - MIME database */
     temp->src  = src;
     temp->dst  = dst;
     temp->cost = cost;
-    strlcpy(temp->filter, filter, sizeof(temp->filter));
+    cupsCopyString(temp->filter, filter, sizeof(temp->filter));
 
     DEBUG_puts("1mimeAddFilter: Adding new filter.");
     cupsArrayAdd(mime->filters, temp);
index ab2e749e6da7dbe602bca7733a32712d4738ca43..ccf45209638df2c922b7943830e915de2194a006 100644 (file)
@@ -1008,7 +1008,7 @@ add_class(cupsd_client_t  *con,           /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "printer-state-message",
                                IPP_TAG_TEXT)) != NULL)
   {
-    strlcpy(pclass->state_message, attr->values[0].string.text,
+    cupsCopyString(pclass->state_message, attr->values[0].string.text,
             sizeof(pclass->state_message));
 
     cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, pclass, NULL, "%s",
@@ -2428,7 +2428,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     }
 
     if (printer->sanitized_device_uri)
-      strlcpy(old_device_uri, printer->sanitized_device_uri,
+      cupsCopyString(old_device_uri, printer->sanitized_device_uri,
               sizeof(old_device_uri));
     else
       old_device_uri[0] = '\0';
@@ -2569,7 +2569,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "printer-state-message",
                                IPP_TAG_TEXT)) != NULL)
   {
-    strlcpy(printer->state_message, attr->values[0].string.text,
+    cupsCopyString(printer->state_message, attr->values[0].string.text,
             sizeof(printer->state_message));
 
     cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, "%s",
@@ -2650,7 +2650,7 @@ add_printer(cupsd_client_t  *con, /* I - Client connection */
     need_restart_job = 1;
     changed_driver   = 1;
 
-    strlcpy(srcfile, con->filename, sizeof(srcfile));
+    cupsCopyString(srcfile, con->filename, sizeof(srcfile));
 
     if ((fp = cupsFileOpen(srcfile, "rb")))
     {
@@ -3725,7 +3725,7 @@ check_quotas(cupsd_client_t  *con,        /* I - Client connection */
   * Figure out who is printing...
   */
 
-  strlcpy(username, get_username(con), sizeof(username));
+  cupsCopyString(username, get_username(con), sizeof(username));
 
   if ((name = strchr(username, '@')) != NULL)
     *name = '\0';                      /* Strip @REALM */
@@ -4181,7 +4181,7 @@ copy_banner(cupsd_client_t *con,  /* I - Client connection */
   * Try the localized banner file under the subdirectory...
   */
 
-  strlcpy(attrname, job->attrs->attrs->next->values[0].string.text,
+  cupsCopyString(attrname, job->attrs->attrs->next->values[0].string.text,
           sizeof(attrname));
   if (strlen(attrname) > 2 && attrname[2] == '-')
   {
@@ -4667,7 +4667,7 @@ copy_model(cupsd_client_t *con,           /* I - Client connection */
         }
       }
       else if (!strncmp(buffer, "*cupsProtocol:", 14))
-        strlcpy(cups_protocol, buffer, sizeof(cups_protocol));
+        cupsCopyString(cups_protocol, buffer, sizeof(cups_protocol));
 
     cupsFileClose(dst);
   }
@@ -6330,7 +6330,7 @@ get_devices(cupsd_client_t *con)  /* I - Client connection */
   if (requested)
     url_encode_attr(requested, requested_str, sizeof(requested_str));
   else
-    strlcpy(requested_str, "requested-attributes=all", sizeof(requested_str));
+    cupsCopyString(requested_str, "requested-attributes=all", sizeof(requested_str));
 
   if (exclude)
     url_encode_attr(exclude, exclude_str, sizeof(exclude_str));
@@ -6880,7 +6880,7 @@ get_jobs(cupsd_client_t  *con,            /* I - Client connection */
     return;
   }
   else if (attr && attr->values[0].boolean)
-    strlcpy(username, get_username(con), sizeof(username));
+    cupsCopyString(username, get_username(con), sizeof(username));
   else
     username[0] = '\0';
 
@@ -7409,7 +7409,7 @@ get_ppds(cupsd_client_t *con)             /* I - Client connection */
   if (requested)
     url_encode_attr(requested, requested_str, sizeof(requested_str));
   else
-    strlcpy(requested_str, "requested-attributes=all", sizeof(requested_str));
+    cupsCopyString(requested_str, "requested-attributes=all", sizeof(requested_str));
 
   if (device)
     url_encode_attr(device, device_str, sizeof(device_str));
@@ -7986,7 +7986,7 @@ get_subscriptions(cupsd_client_t  *con,   /* I - Client connection */
   if ((attr = ippFindAttribute(con->request, "my-subscriptions",
                                IPP_TAG_BOOLEAN)) != NULL &&
       attr->values[0].boolean)
-    strlcpy(username, get_username(con), sizeof(username));
+    cupsCopyString(username, get_username(con), sizeof(username));
   else
     username[0] = '\0';
 
@@ -8700,8 +8700,8 @@ print_job(cupsd_client_t  *con,           /* I - Client connection */
     * Auto-type it!
     */
 
-    strlcpy(super, "application", sizeof(super));
-    strlcpy(type, "octet-stream", sizeof(type));
+    cupsCopyString(super, "application", sizeof(super));
+    cupsCopyString(type, "octet-stream", sizeof(type));
   }
 
   cupsRWLockRead(&MimeDatabase->lock);
@@ -9081,10 +9081,10 @@ reject_jobs(cupsd_client_t  *con,       /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-state-message",
                                IPP_TAG_TEXT)) == NULL)
-    strlcpy(printer->state_message, "Rejecting Jobs",
+    cupsCopyString(printer->state_message, "Rejecting Jobs",
             sizeof(printer->state_message));
   else
-    strlcpy(printer->state_message, attr->values[0].string.text,
+    cupsCopyString(printer->state_message, attr->values[0].string.text,
             sizeof(printer->state_message));
 
   cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL,
@@ -9948,8 +9948,8 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
     * No document format attribute?  Auto-type it!
     */
 
-    strlcpy(super, "application", sizeof(super));
-    strlcpy(type, "octet-stream", sizeof(type));
+    cupsCopyString(super, "application", sizeof(super));
+    cupsCopyString(type, "octet-stream", sizeof(type));
   }
 
   cupsRWLockRead(&MimeDatabase->lock);
@@ -11022,7 +11022,7 @@ set_printer_defaults(
     * OK, anything else must be a user-defined default...
     */
 
-    strlcpy(name, attr->name, sizeof(name));
+    cupsCopyString(name, attr->name, sizeof(name));
     name[namelen - 8] = '\0';          /* Strip "-default" */
 
     switch (attr->value_tag)
@@ -11224,10 +11224,10 @@ stop_printer(cupsd_client_t  *con,    /* I - Client connection */
 
   if ((attr = ippFindAttribute(con->request, "printer-state-message",
                                IPP_TAG_TEXT)) == NULL)
-    strlcpy(printer->state_message, "Paused", sizeof(printer->state_message));
+    cupsCopyString(printer->state_message, "Paused", sizeof(printer->state_message));
   else
   {
-    strlcpy(printer->state_message, attr->values[0].string.text,
+    cupsCopyString(printer->state_message, attr->values[0].string.text,
             sizeof(printer->state_message));
   }
 
@@ -11262,7 +11262,7 @@ url_encode_attr(ipp_attribute_t *attr,  /* I - Attribute */
        *bufend;                        /* End of buffer */
 
 
-  strlcpy(buffer, attr->name, bufsize);
+  cupsCopyString(buffer, attr->name, bufsize);
   bufptr = buffer + strlen(buffer);
   bufend = buffer + bufsize - 1;
 
@@ -11368,7 +11368,7 @@ user_allowed(cupsd_printer_t *p,        /* I - Printer or class */
     * Strip @REALM for username check...
     */
 
-    strlcpy(baseuser, username, sizeof(baseuser));
+    cupsCopyString(baseuser, username, sizeof(baseuser));
 
     if ((baseptr = strchr(baseuser, '@')) != NULL)
       *baseptr = '\0';
@@ -11632,7 +11632,7 @@ validate_user(cupsd_job_t    *job,      /* I - Job */
   * Get the best authenticated username that is available.
   */
 
-  strlcpy(username, get_username(con), userlen);
+  cupsCopyString(username, get_username(con), userlen);
 
  /*
   * Check the username against the owner...
index 89afab4b2ec044759feb43d7f6e5831efd21e6ad..0584f29a576a9f8419b02719b12a430dcba0b01c 100644 (file)
@@ -939,7 +939,7 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
                           IPP_TAG_LANGUAGE);
 
 #ifdef __APPLE__
-  strlcpy(apple_language, "APPLE_LANGUAGE=", sizeof(apple_language));
+  cupsCopyString(apple_language, "APPLE_LANGUAGE=", sizeof(apple_language));
   _cupsAppleLanguage(attr->values[0].string.text,
                     apple_language + 15, sizeof(apple_language) - 15);
 #endif /* __APPLE__ */
@@ -952,7 +952,7 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
        * the POSIX locale...
        */
 
-       strlcpy(lang, "LANG=C", sizeof(lang));
+       cupsCopyString(lang, "LANG=C", sizeof(lang));
        break;
 
     case 2 :
@@ -982,7 +982,7 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
       (ptr = strstr(attr->values[0].string.text, "charset=")) != NULL)
     snprintf(charset, sizeof(charset), "CHARSET=%s", ptr + 8);
   else
-    strlcpy(charset, "CHARSET=utf-8", sizeof(charset));
+    cupsCopyString(charset, "CHARSET=utf-8", sizeof(charset));
 
   snprintf(content_type, sizeof(content_type), "CONTENT_TYPE=%s/%s",
            job->filetypes[job->current_file]->super,
@@ -1010,14 +1010,14 @@ cupsdContinueJob(cupsd_job_t *job)      /* I - Job */
       * All of these strcpy's are safe because we allocated the psr string...
       */
 
-      strlcpy(printer_state_reasons, "PRINTER_STATE_REASONS=", psrlen);
+      cupsCopyString(printer_state_reasons, "PRINTER_STATE_REASONS=", psrlen);
       for (psrptr = printer_state_reasons + 22, i = 0;
            i < job->printer->num_reasons;
           i ++)
       {
         if (i)
          *psrptr++ = ',';
-       strlcpy(psrptr, job->printer->reasons[i], psrlen - (size_t)(psrptr - printer_state_reasons));
+       cupsCopyString(psrptr, job->printer->reasons[i], psrlen - (size_t)(psrptr - printer_state_reasons));
        psrptr += strlen(psrptr);
       }
     }
@@ -1046,7 +1046,7 @@ cupsdContinueJob(cupsd_job_t *job)        /* I - Job */
             job->printer->auth_info_required[2],
             job->printer->auth_info_required[3]);
   else
-    strlcpy(auth_info_required, "AUTH_INFO_REQUIRED=none",
+    cupsCopyString(auth_info_required, "AUTH_INFO_REQUIRED=none",
            sizeof(auth_info_required));
 
   envc = cupsdLoadEnv(envp, (int)(sizeof(envp) / sizeof(envp[0])));
@@ -1135,7 +1135,7 @@ cupsdContinueJob(cupsd_job_t *job)        /* I - Job */
       snprintf(command, sizeof(command), "%s/filter/%s", ServerBin,
                filter->filter);
     else
-      strlcpy(command, filter->filter, sizeof(command));
+      cupsCopyString(command, filter->filter, sizeof(command));
 
     if (i < (cupsArrayCount(filters) - 1))
     {
@@ -2298,7 +2298,7 @@ cupsdSaveJob(cupsd_job_t *job)            /* I - Job */
     * Remove backup file and mark this job as clean...
     */
 
-    strlcat(filename, ".O", sizeof(filename));
+    cupsConcatString(filename, ".O", sizeof(filename));
     unlink(filename);
 
     job->dirty = 0;
@@ -3033,7 +3033,7 @@ dump_job_history(cupsd_job_t *job)        /* I - Job */
     snprintf(temp, sizeof(temp), "[Job %d] printer-state-reasons=", job->id);
     ptr = temp + strlen(temp);
     if (printer->num_reasons == 0)
-      strlcpy(ptr, "none", sizeof(temp) - (size_t)(ptr - temp));
+      cupsCopyString(ptr, "none", sizeof(temp) - (size_t)(ptr - temp));
     else
     {
       for (i = 0;
@@ -3043,7 +3043,7 @@ dump_job_history(cupsd_job_t *job)        /* I - Job */
         if (i)
          *ptr++ = ',';
 
-       strlcpy(ptr, printer->reasons[i], sizeof(temp) - (size_t)(ptr - temp));
+       cupsCopyString(ptr, printer->reasons[i], sizeof(temp) - (size_t)(ptr - temp));
        ptr += strlen(ptr);
       }
     }
@@ -3933,7 +3933,7 @@ get_options(cupsd_job_t *job,             /* I - Job */
   *optptr = '\0';
 
   snprintf(title, title_size, "%s-%d", job->printer->name, job->id);
-  strlcpy(copies, "1", copies_size);
+  cupsCopyString(copies, "1", copies_size);
 
   for (attr = job->attrs->attrs; attr != NULL; attr = attr->next)
   {
@@ -3950,7 +3950,7 @@ get_options(cupsd_job_t *job,             /* I - Job */
     else if (!strcmp(attr->name, "job-name") &&
             (attr->value_tag == IPP_TAG_NAME ||
              attr->value_tag == IPP_TAG_NAMELANG))
-      strlcpy(title, attr->values[0].string.text, title_size);
+      cupsCopyString(title, attr->values[0].string.text, title_size);
     else if (attr->group_tag == IPP_TAG_JOB)
     {
      /*
@@ -4009,18 +4009,18 @@ get_options(cupsd_job_t *job,           /* I - Job */
       */
 
       if (optptr > options)
-       strlcat(optptr, " ", optlength - (size_t)(optptr - options));
+       cupsConcatString(optptr, " ", optlength - (size_t)(optptr - options));
 
       if (attr->value_tag != IPP_TAG_BOOLEAN)
       {
-       strlcat(optptr, attr->name, optlength - (size_t)(optptr - options));
-       strlcat(optptr, "=", optlength - (size_t)(optptr - options));
+       cupsConcatString(optptr, attr->name, optlength - (size_t)(optptr - options));
+       cupsConcatString(optptr, "=", optlength - (size_t)(optptr - options));
       }
 
       for (i = 0; i < attr->num_values; i ++)
       {
        if (i)
-         strlcat(optptr, ",", optlength - (size_t)(optptr - options));
+         cupsConcatString(optptr, ",", optlength - (size_t)(optptr - options));
 
        optptr += strlen(optptr);
 
@@ -4034,9 +4034,9 @@ get_options(cupsd_job_t *job,             /* I - Job */
 
          case IPP_TAG_BOOLEAN :
              if (!attr->values[i].boolean)
-               strlcat(optptr, "no", optlength - (size_t)(optptr - options));
+               cupsConcatString(optptr, "no", optlength - (size_t)(optptr - options));
 
-             strlcat(optptr, attr->name, optlength - (size_t)(optptr - options));
+             cupsConcatString(optptr, attr->name, optlength - (size_t)(optptr - options));
              break;
 
          case IPP_TAG_RANGE :
@@ -4129,10 +4129,10 @@ get_options(cupsd_job_t *job,           /* I - Job */
   for (i = num_pwgppds, pwgppd = pwgppds; i > 0; i --, pwgppd ++)
   {
     *optptr++ = ' ';
-    strlcpy(optptr, pwgppd->name, optlength - (size_t)(optptr - options));
+    cupsCopyString(optptr, pwgppd->name, optlength - (size_t)(optptr - options));
     optptr += strlen(optptr);
     *optptr++ = '=';
-    strlcpy(optptr, pwgppd->value, optlength - (size_t)(optptr - options));
+    cupsCopyString(optptr, pwgppd->value, optlength - (size_t)(optptr - options));
     optptr += strlen(optptr);
   }
 
@@ -5413,7 +5413,7 @@ update_job(cupsd_job_t *job)              /* I - Job to check */
       if (loglevel < CUPSD_LOG_DEBUG &&
           strcmp(job->printer->state_message, ptr))
       {
-       strlcpy(job->printer->state_message, ptr,
+       cupsCopyString(job->printer->state_message, ptr,
                sizeof(job->printer->state_message));
 
        event |= CUPSD_EVENT_PRINTER_STATE | CUPSD_EVENT_JOB_PROGRESS;
index 65d2a4116bc8e17f35dfc2b097ac4142fab943ad..8928df490fc3b85d3159ad1bfa069c2a5678cb9b 100644 (file)
@@ -146,8 +146,8 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
 
     if (logname[0] != '/')
     {
-      strlcpy(filename, ServerRoot, sizeof(filename));
-      strlcat(filename, "/", sizeof(filename));
+      cupsCopyString(filename, ServerRoot, sizeof(filename));
+      cupsConcatString(filename, "/", sizeof(filename));
     }
     else
       filename[0] = '\0';
@@ -168,7 +168,7 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
          * Insert the server name...
          */
 
-         strlcpy(ptr, ServerName, sizeof(filename) - (size_t)(ptr - filename));
+         cupsCopyString(ptr, ServerName, sizeof(filename) - (size_t)(ptr - filename));
          ptr += strlen(ptr);
        }
         else
@@ -260,8 +260,8 @@ cupsdCheckLogFile(cups_file_t **lf, /* IO - Log file */
 
     cupsFileClose(*lf);
 
-    strlcpy(backname, filename, sizeof(backname));
-    strlcat(backname, ".O", sizeof(backname));
+    cupsCopyString(backname, filename, sizeof(backname));
+    cupsConcatString(backname, ".O", sizeof(backname));
 
     unlink(backname);
     rename(filename, backname);
@@ -405,7 +405,7 @@ cupsdLogFCMessage(
     if (result == _CUPS_FILE_CHECK_MISSING ||
         result == _CUPS_FILE_CHECK_WRONG_TYPE)
     {
-      strlcpy(p->state_message, message, sizeof(p->state_message));
+      cupsCopyString(p->state_message, message, sizeof(p->state_message));
 
       if (cupsdSetPrinterReasons(p, "+cups-missing-filter-warning"))
         cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, p, NULL, "%s", message);
@@ -413,7 +413,7 @@ cupsdLogFCMessage(
     else if (result == _CUPS_FILE_CHECK_PERMISSIONS ||
              result == _CUPS_FILE_CHECK_RELATIVE_PATH)
     {
-      strlcpy(p->state_message, message, sizeof(p->state_message));
+      cupsCopyString(p->state_message, message, sizeof(p->state_message));
 
       if (cupsdSetPrinterReasons(p, "+cups-insecure-filter-warning"))
         cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, p, NULL, "%s", message);
@@ -519,7 +519,7 @@ cupsdLogClient(cupsd_client_t *con, /* I - Client connection */
     snprintf(clientmsg, sizeof(clientmsg), "[Client %d] %s", con->number,
              message);
   else
-    strlcpy(clientmsg, message, sizeof(clientmsg));
+    cupsCopyString(clientmsg, message, sizeof(clientmsg));
 
   va_start(ap, message);
 
@@ -573,7 +573,7 @@ cupsdLogJob(cupsd_job_t *job,               /* I - Job */
   if (job)
     snprintf(jobmsg, sizeof(jobmsg), "[Job %d] %s", job->id, message);
   else
-    strlcpy(jobmsg, message, sizeof(jobmsg));
+    cupsCopyString(jobmsg, message, sizeof(jobmsg));
 
   va_start(ap, message);
 
@@ -785,7 +785,7 @@ cupsdLogPage(cupsd_job_t *job,              /* I - Job being printed */
   if (!PageLogFormat)
     return (1);
 
-  strlcpy(number, "1", sizeof(number));
+  cupsCopyString(number, "1", sizeof(number));
   copies = 1;
   sscanf(page, "%255s%d", number, &copies);
 
@@ -803,7 +803,7 @@ cupsdLogPage(cupsd_job_t *job,              /* I - Job being printed */
            break;
 
         case 'p' :                     /* Printer name */
-           strlcpy(bufptr, job->dest, sizeof(buffer) - (size_t)(bufptr - buffer));
+           cupsCopyString(bufptr, job->dest, sizeof(buffer) - (size_t)(bufptr - buffer));
            bufptr += strlen(bufptr);
            break;
 
@@ -813,17 +813,17 @@ cupsdLogPage(cupsd_job_t *job,            /* I - Job being printed */
            break;
 
         case 'u' :                     /* Username */
-           strlcpy(bufptr, job->username ? job->username : "-", sizeof(buffer) - (size_t)(bufptr - buffer));
+           cupsCopyString(bufptr, job->username ? job->username : "-", sizeof(buffer) - (size_t)(bufptr - buffer));
            bufptr += strlen(bufptr);
            break;
 
         case 'T' :                     /* Date and time */
-           strlcpy(bufptr, cupsdGetDateTime(NULL, LogTimeFormat), sizeof(buffer) - (size_t)(bufptr - buffer));
+           cupsCopyString(bufptr, cupsdGetDateTime(NULL, LogTimeFormat), sizeof(buffer) - (size_t)(bufptr - buffer));
            bufptr += strlen(bufptr);
            break;
 
         case 'P' :                     /* Page number */
-           strlcpy(bufptr, number, sizeof(buffer) - (size_t)(bufptr - buffer));
+           cupsCopyString(bufptr, number, sizeof(buffer) - (size_t)(bufptr - buffer));
            bufptr += strlen(bufptr);
            break;
 
@@ -901,7 +901,7 @@ cupsdLogPage(cupsd_job_t *job,              /* I - Job being printed */
                    case IPP_TAG_CHARSET :
                    case IPP_TAG_LANGUAGE :
                    case IPP_TAG_MIMETYPE :
-                       strlcpy(bufptr, attr->values[i].string.text, sizeof(buffer) - (size_t)(bufptr - buffer));
+                       cupsCopyString(bufptr, attr->values[i].string.text, sizeof(buffer) - (size_t)(bufptr - buffer));
                        bufptr += strlen(bufptr);
                        break;
 
@@ -918,14 +918,14 @@ cupsdLogPage(cupsd_job_t *job,            /* I - Job being printed */
                                        /* PWG media name */
                            if (pwg)
                            {
-                             strlcpy(bufptr, pwg->pwg, sizeof(buffer) - (size_t)(bufptr - buffer));
+                             cupsCopyString(bufptr, pwg->pwg, sizeof(buffer) - (size_t)(bufptr - buffer));
                              break;
                            }
                          }
                        }
 
                    default :
-                       strlcpy(bufptr, "???", sizeof(buffer) - (size_t)(bufptr - buffer));
+                       cupsCopyString(bufptr, "???", sizeof(buffer) - (size_t)(bufptr - buffer));
                        bufptr += strlen(bufptr);
                        break;
                  }
index 6fd112c40a2ff998cbfcac56c1a855b0195e54f6..d94cf310839e2c8dece88e425c86c5717889997b 100644 (file)
@@ -337,7 +337,7 @@ main(int  argc,                             /* I - Number of command-line args */
       return (1);
     }
 
-    strlcpy(filename, ConfigurationFile, len);
+    cupsCopyString(filename, ConfigurationFile, len);
     if ((slash = strrchr(filename, '/')) == NULL)
     {
       free(filename);
@@ -347,7 +347,7 @@ main(int  argc,                             /* I - Number of command-line args */
       return (1);
     }
 
-    strlcpy(slash, "/cups-files.conf", len - (size_t)(slash - filename));
+    cupsCopyString(slash, "/cups-files.conf", len - (size_t)(slash - filename));
     cupsdSetString(&CupsFilesFile, filename);
     free(filename);
   }
@@ -1477,7 +1477,7 @@ process_children(void)
 
             if (job->printer)
            {
-             strlcpy(job->printer->state_message, message,
+             cupsCopyString(job->printer->state_message, message,
                       sizeof(job->printer->state_message));
            }
 
@@ -2006,7 +2006,7 @@ service_checkout(int shutdown)          /* I - Shutting down? */
   {
     int shared_printers = 0;           /* Do we have shared printers? */
 
-    strlcpy(pidfile, CUPS_KEEPALIVE, sizeof(pidfile));
+    cupsCopyString(pidfile, CUPS_KEEPALIVE, sizeof(pidfile));
 
    /*
     * If printer sharing is on see if there are any actual shared printers...
index bf741596b2e82e560bca73e0b66b54023a509d65..e4f4c0d3e975639c5e071e1010da37195262551b 100644 (file)
@@ -11,6 +11,7 @@
  * Include necessary headers...
  */
 
+#include <cups/cups.h>
 #include <cups/string-private.h>
 #include <cups/dir.h>
 #include "mime-private.h"
@@ -815,8 +816,8 @@ mime_load_convs(
       * Force * / * to be "application/octet-stream"...
       */
 
-      strlcpy(super, "application", sizeof(super));
-      strlcpy(type, "octet-stream", sizeof(type));
+      cupsCopyString(super, "application", sizeof(super));
+      cupsCopyString(type, "octet-stream", sizeof(type));
     }
 
    /*
index 5ba00a1fb636832e2244ba67e84c47f11fd0c845..43fed6518fa698a6416a4c914bc0f55dd5a5d678 100644 (file)
@@ -46,7 +46,7 @@ cupsdNetIFFind(const char *name)      /* I - Name of interface */
   * Search for the named interface...
   */
 
-  strlcpy(key.name, name, sizeof(key.name));
+  cupsCopyString(key.name, name, sizeof(key.name));
 
   return ((cupsd_netif_t *)cupsArrayFind(NetIFList, &key));
 }
@@ -161,7 +161,7 @@ cupsdNetIFUpdate(void)
       */
 
       if (httpAddrLocalhost((http_addr_t *)(addr->ifa_addr)))
-        strlcpy(hostname, "localhost", sizeof(hostname));
+        cupsCopyString(hostname, "localhost", sizeof(hostname));
       else
        httpAddrString((http_addr_t *)(addr->ifa_addr), hostname,
                       sizeof(hostname));
@@ -182,7 +182,7 @@ cupsdNetIFUpdate(void)
     * Copy all of the information...
     */
 
-    strlcpy(temp->name, addr->ifa_name, sizeof(temp->name));
+    cupsCopyString(temp->name, addr->ifa_name, sizeof(temp->name));
     temp->hostlen = hostlen;
     memcpy(temp->hostname, hostname, hostlen + 1);
 
index 960fbef933fd5d6109625e120ef34b42bd04a4e9..434f08c9a100bdab4b85628089e5b11ad9d761dd 100644 (file)
@@ -1117,7 +1117,7 @@ cupsdLoadAllPrinters(void)
       */
 
       if (value)
-       strlcpy(p->state_message, value, sizeof(p->state_message));
+       cupsCopyString(p->state_message, value, sizeof(p->state_message));
     }
     else if (!_cups_strcasecmp(line, "StateTime"))
     {
@@ -1474,7 +1474,7 @@ cupsdSaveAllPrinters(void)
       switch (printer->num_auth_info_required)
       {
         case 1 :
-            strlcpy(value, printer->auth_info_required[0], sizeof(value));
+            cupsCopyString(value, printer->auth_info_required[0], sizeof(value));
            break;
 
         case 2 :
@@ -1587,7 +1587,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
+        cupsCopyString(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
@@ -1646,7 +1646,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
+        cupsCopyString(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
@@ -1666,7 +1666,7 @@ cupsdSaveAllPrinters(void)
         if (i)
          *ptr++ = ',';
 
-        strlcpy(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
+        cupsCopyString(ptr, marker->values[i].string.text, (size_t)(value + sizeof(value) - ptr));
         ptr += strlen(ptr);
       }
 
@@ -1876,7 +1876,7 @@ cupsdSetDeviceURI(cupsd_printer_t *p,     /* I - Printer */
   * info in it...
   */
 
-  strlcpy(buffer, uri, sizeof(buffer));
+  cupsCopyString(buffer, uri, sizeof(buffer));
 
  /*
   * Find the end of the scheme:// part...
@@ -3029,9 +3029,9 @@ cupsdValidateDest(
   */
 
   if (!_cups_strcasecmp(hostname, "localhost"))
-    strlcpy(hostname, ServerName, sizeof(hostname));
+    cupsCopyString(hostname, ServerName, sizeof(hostname));
 
-  strlcpy(localname, hostname, sizeof(localname));
+  cupsCopyString(localname, hostname, sizeof(localname));
 
   if (!_cups_strcasecmp(hostname, ServerName))
   {
@@ -3466,7 +3466,7 @@ add_printer_filter(
   if (strcmp(program, "-"))
   {
     if (program[0] == '/')
-      strlcpy(filename, program, sizeof(filename));
+      cupsCopyString(filename, program, sizeof(filename));
     else
       snprintf(filename, sizeof(filename), "%s/filter/%s", ServerBin, program);
 
@@ -3653,20 +3653,20 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */
       if (!_cups_strcasecmp(type->super, "application"))
       {
         if (!_cups_strcasecmp(type->type, "pdf"))
-         strlcat(pdl, "application/pdf,", sizeof(pdl));
+         cupsConcatString(pdl, "application/pdf,", sizeof(pdl));
         else if (!_cups_strcasecmp(type->type, "postscript"))
-         strlcat(pdl, "application/postscript,", sizeof(pdl));
+         cupsConcatString(pdl, "application/postscript,", sizeof(pdl));
       }
       else if (!_cups_strcasecmp(type->super, "image"))
       {
         if (!_cups_strcasecmp(type->type, "jpeg"))
-         strlcat(pdl, "image/jpeg,", sizeof(pdl));
+         cupsConcatString(pdl, "image/jpeg,", sizeof(pdl));
        else if (!_cups_strcasecmp(type->type, "png"))
-         strlcat(pdl, "image/png,", sizeof(pdl));
+         cupsConcatString(pdl, "image/png,", sizeof(pdl));
        else if (!_cups_strcasecmp(type->type, "pwg-raster"))
-         strlcat(pdl, "image/pwg-raster,", sizeof(pdl));
+         cupsConcatString(pdl, "image/pwg-raster,", sizeof(pdl));
        else if (!_cups_strcasecmp(type->type, "urf"))
-         strlcat(pdl, "image/urf,", sizeof(pdl));
+         cupsConcatString(pdl, "image/urf,", sizeof(pdl));
       }
     }
 
@@ -4738,7 +4738,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
                       "printer-resolution-supported", IPP_RES_PER_INCH,
                       300, 300);
       ippAddResolution(p->ppd_attrs, IPP_TAG_PRINTER, "pwg-raster-document-resolution-supported", IPP_RES_PER_INCH, 300, 300);
-      strlcpy(urf_rs, "RS300", sizeof(urf_rs));
+      cupsCopyString(urf_rs, "RS300", sizeof(urf_rs));
       urf[num_urf ++] = urf_rs;
     }
 
index 7c80a720f5cf73d86833ff76edc810cef0d8569b..6579165162002c9fc5e5693aba61b04671c3415e 100644 (file)
@@ -432,7 +432,7 @@ cupsdFinishProcess(int    pid,              /* I - Process ID */
     if (job_id)
       *job_id = proc->job_id;
 
-    strlcpy(name, proc->name, namelen);
+    cupsCopyString(name, proc->name, namelen);
     cupsArrayRemove(process_array, proc);
     free(proc);
   }
@@ -441,7 +441,7 @@ cupsdFinishProcess(int    pid,              /* I - Process ID */
     if (job_id)
       *job_id = 0;
 
-    strlcpy(name, "unknown", namelen);
+    cupsCopyString(name, "unknown", namelen);
   }
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishProcess(pid=%d, name=%p, namelen=" CUPS_LLFMT ", job_id=%p(%d)) = \"%s\"", pid, name, CUPS_LLCAST namelen, job_id, job_id ? *job_id : 0, name);
index d649dcb833f8e09452caa8901d2968d5d974fa35..88408ffc8da57703403120d36df11e19ea0492f0 100644 (file)
@@ -40,7 +40,7 @@ cupsdFindQuota(
   if (!p || !username)
     return (NULL);
 
-  strlcpy(match.username, username, sizeof(match.username));
+  cupsCopyString(match.username, username, sizeof(match.username));
   if ((ptr = strchr(match.username, '@')) != NULL)
     *ptr = '\0';                       /* Strip @domain/@KDC */
 
@@ -203,7 +203,7 @@ add_quota(cupsd_printer_t *p,               /* I - Printer */
   if ((q = calloc(1, sizeof(cupsd_quota_t))) == NULL)
     return (NULL);
 
-  strlcpy(q->username, username, sizeof(q->username));
+  cupsCopyString(q->username, username, sizeof(q->username));
   if ((ptr = strchr(q->username, '@')) != NULL)
     *ptr = '\0';                       /* Strip @domain/@KDC */
 
index db9d98d41d5c1b6fe43d58a8afc9a6e74463bcc8..ea8086164502c0c1dedf9c521c5b2ab00ccbeb34 100644 (file)
@@ -299,7 +299,7 @@ cupsdStatBufUpdate(
   * Copy the message to the line buffer...
   */
 
-  strlcpy(line, message, (size_t)linelen);
+  cupsCopyString(line, message, (size_t)linelen);
 
  /*
   * Copy over the buffer data we've used up...
index 9b31ec250e88cdce4cf846a578709151adb7af50..dbd8423517e94f1dbca65b08a3de9adc3bdaac5c 100644 (file)
@@ -1450,7 +1450,7 @@ cupsd_start_notifier(
   * notifier program...
   */
 
-  strlcpy(scheme, sub->recipient, sizeof(scheme));
+  cupsCopyString(scheme, sub->recipient, sizeof(scheme));
   if ((ptr = strchr(scheme, ':')) != NULL)
     *ptr = '\0';
 
index 22656cd913f4bc915efa772a6c0f74feb1b51c35..5808f4493c8575b0b03b6855b82b4c2f0f06f5b0 100644 (file)
@@ -150,17 +150,17 @@ main(int  argc,                           /* I - Number of command-line arguments */
     snprintf(reqstr, sizeof(reqstr), "%d", requests);
 
     if (port == 631 || server[0] == '/')
-      strlcpy(serverstr, server, sizeof(serverstr));
+      cupsCopyString(serverstr, server, sizeof(serverstr));
     else
       snprintf(serverstr, sizeof(serverstr), "%s:%d", server, port);
 
-    strlcpy(options, "-cr", sizeof(options));
+    cupsCopyString(options, "-cr", sizeof(options));
 
     if (encryption == HTTP_ENCRYPTION_REQUIRED)
-      strlcat(options, "E", sizeof(options));
+      cupsConcatString(options, "E", sizeof(options));
 
     if (verbose)
-      strlcat(options, "v", sizeof(options));
+      cupsConcatString(options, "v", sizeof(options));
 
     for (i = 0; i < children; i ++)
     {
index c31cb57ffc623f34dd2a92a5ad9c2db63dc1370f..1effe841ed01f0b8638a17b803886c635d355c49 100644 (file)
@@ -13,6 +13,7 @@
  * Include necessary headers...
  */
 
+#include <cups/cups.h>
 #include <cups/string-private.h>
 #include <locale.h>
 #include "mime.h"
@@ -131,7 +132,7 @@ mimeAddType(mime_t     *mime,               /* I - MIME database */
     return (NULL);
   }
 
-  strlcpy(temp->super, super, sizeof(temp->super));
+  cupsCopyString(temp->super, super, sizeof(temp->super));
   memcpy(temp->type, type, typelen);
   temp->priority = 100;
 
@@ -512,7 +513,7 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
         case MIME_MAGIC_MATCH :
            if ((size_t)length[0] > (sizeof(temp->value.matchv) - 1))
              return (-1);
-           strlcpy(temp->value.matchv, value[0], sizeof(temp->value.matchv));
+           cupsCopyString(temp->value.matchv, value[0], sizeof(temp->value.matchv));
            break;
        case MIME_MAGIC_ASCII :
        case MIME_MAGIC_PRINTABLE :
@@ -559,7 +560,7 @@ mimeAddTypeRule(mime_type_t *mt,    /* I - Type to add to */
            if ((size_t)length[0] > (sizeof(temp->value.localev) - 1))
              return (-1);
 
-           strlcpy(temp->value.localev, value[0], sizeof(temp->value.localev));
+           cupsCopyString(temp->value.localev, value[0], sizeof(temp->value.localev));
            break;
        case MIME_MAGIC_CONTAINS :
            temp->offset = strtol(value[0], NULL, 0);
@@ -715,8 +716,8 @@ mimeType(mime_t     *mime,          /* I - MIME database */
   * Lookup the type in the array...
   */
 
-  strlcpy(key.super, super, sizeof(key.super));
-  strlcpy(key.type, type, sizeof(key.type));
+  cupsCopyString(key.super, super, sizeof(key.super));
+  cupsCopyString(key.type, type, sizeof(key.type));
 
   mt = (mime_type_t *)cupsArrayFind(mime->types, &key);
   DEBUG_printf("1mimeType: Returning %p.", mt);
index d9f9c01265ce284310f0275c368e57edeeb50182..112a9f10b6747bd90e9bd0ab92e96153845e2bbe 100644 (file)
@@ -1856,7 +1856,7 @@ check_constraints(ppd_file_t *ppd,        /* I - PPD file */
         if (!_cups_strncasecmp(option, "Custom", 6) && !_cups_strcasecmp(choice, "True"))
        {
          _cups_strcpy(option, option + 6);
-         strlcpy(choice, "Custom", sizeof(choice));
+         cupsCopyString(choice, "Custom", sizeof(choice));
        }
 
         if ((o = ppdFindOption(ppd, option)) == NULL)
@@ -1957,13 +1957,13 @@ check_constraints(ppd_file_t *ppd,      /* I - PPD file */
       if (!_cups_strncasecmp(c->option1, "Custom", 6) &&
           !_cups_strcasecmp(c->choice1, "True"))
       {
-       strlcpy(option, c->option1 + 6, sizeof(option));
-       strlcpy(choice, "Custom", sizeof(choice));
+       cupsCopyString(option, c->option1 + 6, sizeof(option));
+       cupsCopyString(choice, "Custom", sizeof(choice));
       }
       else
       {
-       strlcpy(option, c->option1, sizeof(option));
-       strlcpy(choice, c->choice1, sizeof(choice));
+       cupsCopyString(option, c->option1, sizeof(option));
+       cupsCopyString(choice, c->choice1, sizeof(choice));
       }
 
       if ((o = ppdFindOption(ppd, option)) == NULL)
@@ -1998,13 +1998,13 @@ check_constraints(ppd_file_t *ppd,      /* I - PPD file */
       if (!_cups_strncasecmp(c->option2, "Custom", 6) &&
           !_cups_strcasecmp(c->choice2, "True"))
       {
-       strlcpy(option, c->option2 + 6, sizeof(option));
-       strlcpy(choice, "Custom", sizeof(choice));
+       cupsCopyString(option, c->option2 + 6, sizeof(option));
+       cupsCopyString(choice, "Custom", sizeof(choice));
       }
       else
       {
-       strlcpy(option, c->option2, sizeof(option));
-       strlcpy(choice, c->choice2, sizeof(choice));
+       cupsCopyString(option, c->option2, sizeof(option));
+       cupsCopyString(choice, c->choice2, sizeof(choice));
       }
 
       if ((o = ppdFindOption(ppd, option)) == NULL)
@@ -3268,12 +3268,12 @@ check_sizes(ppd_file_t *ppd,            /* I - PPD file */
         size_t ppdlen = strlen(pwg_media->ppd);
                                        /* Length of standard PPD name */
 
-        strlcpy(buf, pwg_media->ppd, sizeof(buf));
+        cupsCopyString(buf, pwg_media->ppd, sizeof(buf));
 
         if (strcmp(size->name, buf) && size->width > size->length)
         {
           if (!strcmp(pwg_media->ppd, "DoublePostcardRotated"))
-            strlcpy(buf, "DoublePostcard", sizeof(buf));
+            cupsCopyString(buf, "DoublePostcard", sizeof(buf));
           else if (strstr(size->name, ".Transverse"))
             snprintf(buf, sizeof(buf), "%s.Transverse", pwg_media->ppd);
           else
@@ -3285,7 +3285,7 @@ check_sizes(ppd_file_t *ppd,              /* I - PPD file */
         if (size->left == 0 && size->bottom == 0 &&
            size->right == size->width && size->top == size->length)
         {
-          strlcat(buf, ".Fullbleed", sizeof(buf) - strlen(buf));
+          cupsConcatString(buf, ".Fullbleed", sizeof(buf) - strlen(buf));
          if (_cups_strcasecmp(size->name, buf))
          {
           /*
@@ -3365,9 +3365,9 @@ check_sizes(ppd_file_t *ppd,              /* I - PPD file */
 
         if (size->left == 0 && size->bottom == 0 &&
            size->right == size->width && size->top == size->length)
-          strlcat(buf, ".Fullbleed", sizeof(buf));
+          cupsConcatString(buf, ".Fullbleed", sizeof(buf));
         else if (size->width > size->length)
-          strlcat(buf, ".Transverse", sizeof(buf));
+          cupsConcatString(buf, ".Transverse", sizeof(buf));
 
         if (_cups_strcasecmp(size->name, buf))
         {
@@ -3460,7 +3460,7 @@ check_translations(ppd_file_t *ppd,       /* I - PPD file */
       if (!strcmp(language, "en"))
         continue;
 
-      strlcpy(ll, language, sizeof(ll));
+      cupsCopyString(ll, language, sizeof(ll));
 
      /*
       * Loop through all options and choices...
@@ -3660,7 +3660,7 @@ check_translations(ppd_file_t *ppd,       /* I - PPD file */
 
        cupsArraySave(languages);
 
-       strlcpy(ll, language, sizeof(ll));
+       cupsCopyString(ll, language, sizeof(ll));
 
        if (!cupsArrayFind(languages, ll) &&
            strcmp(ll, "zh") && strcmp(ll, "en"))
@@ -3893,7 +3893,7 @@ valid_path(const char *keyword,           /* I - Keyword using path */
   * the same capitalization...
   */
 
-  strlcpy(temp, path, sizeof(temp));
+  cupsCopyString(temp, path, sizeof(temp));
 
   while ((ptr = strrchr(temp, '/')) != NULL)
   {
index fb1aa67acc45e21cbd261e98bb26b532fa5f899c..f15a9e8cf66487233416f52ed293a2978a51e422 100644 (file)
@@ -1373,7 +1373,7 @@ set_printer_options(
         * Get default option name...
        */
 
-        strlcpy(keyword, line + 8, sizeof(keyword));
+        cupsCopyString(keyword, line + 8, sizeof(keyword));
 
        for (keyptr = keyword; *keyptr; keyptr ++)
          if (*keyptr == ':' || isspace(*keyptr & 255))
index 0654801a23ec3f0a2b5d5333b31fe448fec56b35..77acd5c3678caba137a7cf8d2c0f31f73afa54f2 100644 (file)
@@ -360,7 +360,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
         *ptr++ = ' ';
 
       if (!options[i].value[0])
-        strlcpy(ptr, options[i].name, sizeof(buffer) - (size_t)(ptr - buffer));
+        cupsCopyString(ptr, options[i].name, sizeof(buffer) - (size_t)(ptr - buffer));
       else if (strchr(options[i].value, ' ') != NULL ||
                strchr(options[i].value, '\t') != NULL)
        snprintf(ptr, sizeof(buffer) - (size_t)(ptr - buffer), "%s=\'%s\'", options[i].name, options[i].value);
@@ -452,7 +452,7 @@ list_group(ppd_file_t  *ppd,                /* I - PPD file */
            }
 
             if (ptr < (buffer + sizeof(buffer) - 1))
-             strlcpy(ptr, "}", sizeof(buffer) - (size_t)(ptr - buffer));
+             cupsCopyString(ptr, "}", sizeof(buffer) - (size_t)(ptr - buffer));
          }
        }
       }
index 3b44bc37c2451c74fd9239c68f2faab26211ef88..cfe9a05acee95f13322262c1010d74762adfb56b 100644 (file)
@@ -529,7 +529,7 @@ check_dest(const char  *command,    /* I  - Command name */
       *num_dests = cupsGetDests(dests);
     else
     {
-      strlcpy(printer, name, sizeof(printer));
+      cupsCopyString(printer, name, sizeof(printer));
       if ((pptr = strchr(printer, '/')) != NULL)
         *pptr++ = '\0';
 
@@ -1503,7 +1503,7 @@ show_jobs(const char *dests,              /* I - Destinations */
              if (i)
                snprintf(aptr, sizeof(alerts) - (size_t)(aptr - alerts), " %s", reasons->values[i].string.text);
              else
-               strlcpy(alerts, reasons->values[i].string.text, sizeof(alerts));
+               cupsCopyString(alerts, reasons->values[i].string.text, sizeof(alerts));
 
              aptr += strlen(aptr);
            }
@@ -1846,7 +1846,7 @@ show_printers(const char  *printers,      /* I - Destinations */
              if (i)
                snprintf(aptr, sizeof(alerts) - (size_t)(aptr - alerts), " %s", reasons->values[i].string.text);
              else
-               strlcpy(alerts, reasons->values[i].string.text, sizeof(alerts));
+               cupsCopyString(alerts, reasons->values[i].string.text, sizeof(alerts));
 
              aptr += strlen(aptr);
            }
@@ -1966,7 +1966,7 @@ show_printers(const char  *printers,      /* I - Destinations */
                  if (i)
                    snprintf(aptr, sizeof(alerts) - (size_t)(aptr - alerts), " %s", reasons->values[i].string.text);
                  else
-                   strlcpy(alerts, reasons->values[i].string.text, sizeof(alerts));
+                   cupsCopyString(alerts, reasons->values[i].string.text, sizeof(alerts));
 
                  aptr += strlen(aptr);
                }
index c21dc128e57c4b3cd46e7f04ab6f4640c99c9cc3..19b887c85b8cb7a75730764fc8b7a940faef8ee2 100644 (file)
@@ -539,7 +539,7 @@ main(int  argc,                             /* I - Number of command-line args */
              if (i >= argc)
                usage(1);
 
-             strlcpy(directory, argv[i], sizeof(directory));
+             cupsCopyString(directory, argv[i], sizeof(directory));
              break;
 
          case 'f' : /* -f type/subtype[,...] */
@@ -819,7 +819,7 @@ authenticate_request(
     return (HTTP_STATUS_SERVER_ERROR);
   }
 
-  strlcpy(client->username, data.username, sizeof(client->username));
+  cupsCopyString(client->username, data.username, sizeof(client->username));
 
   pam_end(pamh, PAM_SUCCESS);
 
@@ -1696,12 +1696,12 @@ create_printer(
     const char *avahi_name = avahi_client_get_host_name_fqdn(DNSSDClient);
 
     if (avahi_name)
-      strlcpy(temp, avahi_name, sizeof(temp));
+      cupsCopyString(temp, avahi_name, sizeof(temp));
     else
 #endif /* HAVE_AVAHI */
 
     if ((tempptr = strstr(httpGetHostname(NULL, temp, sizeof(temp)), ".lan")) != NULL && !tempptr[5])
-      strlcpy(tempptr, ".local", sizeof(temp) - (size_t)(tempptr - temp));
+      cupsCopyString(tempptr, ".local", sizeof(temp) - (size_t)(tempptr - temp));
 
     printer->hostname = strdup(temp);
   }
@@ -5962,7 +5962,7 @@ process_http(ippeve_client_t *client)     /* I - Client connection */
     return (0);
   }
 
-  strlcpy(client->host_field, httpGetField(client->http, HTTP_FIELD_HOST), sizeof(client->host_field));
+  cupsCopyString(client->host_field, httpGetField(client->http, HTTP_FIELD_HOST), sizeof(client->host_field));
   if ((ptr = strrchr(client->host_field, ':')) != NULL)
   {
    /*
@@ -7167,7 +7167,7 @@ register_printer(
     if (ptr > formats && ptr < (formats + sizeof(formats) - 1))
       *ptr++ = ',';
 
-    strlcpy(ptr, value, sizeof(formats) - (size_t)(ptr - formats));
+    cupsCopyString(ptr, value, sizeof(formats) - (size_t)(ptr - formats));
     ptr += strlen(ptr);
 
     if (ptr >= (formats + sizeof(formats) - 1))
@@ -7182,7 +7182,7 @@ register_printer(
     if (ptr > urf && ptr < (urf + sizeof(urf) - 1))
       *ptr++ = ',';
 
-    strlcpy(ptr, value, sizeof(urf) - (size_t)(ptr - urf));
+    cupsCopyString(ptr, value, sizeof(urf) - (size_t)(ptr - urf));
     ptr += strlen(ptr);
 
     if (ptr >= (urf + sizeof(urf) - 1))
@@ -7273,7 +7273,7 @@ register_printer(
   if (printer->dnssd_subtypes && *(printer->dnssd_subtypes))
     snprintf(regtype, sizeof(regtype), "_ipp._tcp,%s", printer->dnssd_subtypes);
   else
-    strlcpy(regtype, "_ipp._tcp", sizeof(regtype));
+    cupsCopyString(regtype, "_ipp._tcp", sizeof(regtype));
 
   if ((error = DNSServiceRegister(&(printer->ipp_ref), kDNSServiceFlagsShareConnection | kDNSServiceFlagsNoAutoRename, ifindex, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
   {
@@ -7294,7 +7294,7 @@ register_printer(
   if (printer->dnssd_subtypes && *(printer->dnssd_subtypes))
     snprintf(regtype, sizeof(regtype), "_ipps._tcp,%s", printer->dnssd_subtypes);
   else
-    strlcpy(regtype, "_ipps._tcp", sizeof(regtype));
+    cupsCopyString(regtype, "_ipps._tcp", sizeof(regtype));
 
   if ((error = DNSServiceRegister(&(printer->ipps_ref), kDNSServiceFlagsShareConnection | kDNSServiceFlagsNoAutoRename, ifindex, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
   {
index c463a12f64fd5c48266599bccf5a368e71d192bc..b46eb7dd4a9e6fcd39967025e52ddbf655478a9c 100644 (file)
@@ -1167,7 +1167,7 @@ main(int  argc,                           /* I - Number of command-line args */
                        *regtype,       /* Registration type */
                        *domain;        /* Domain, if any */
 
-    strlcpy(buf, search, sizeof(buf));
+    cupsCopyString(buf, search, sizeof(buf));
 
     if (!strncmp(buf, "_http._", 7) || !strncmp(buf, "_https._", 8) || !strncmp(buf, "_ipp._", 6) || !strncmp(buf, "_ipps._", 7))
     {
@@ -1992,24 +1992,24 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
 
           *kptr = '\0';
           if (!keyword[0] || !strcmp(keyword, "service_uri"))
-           strlcpy(tptr, service->uri, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, service->uri, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_domain"))
-           strlcpy(tptr, service->domain, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, service->domain, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_hostname"))
-           strlcpy(tptr, service->host, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, service->host, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_name"))
-           strlcpy(tptr, service->name, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, service->name, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_path"))
-           strlcpy(tptr, service->resource, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, service->resource, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_port"))
-           strlcpy(tptr, port + 21, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, port + 21, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strcmp(keyword, "service_scheme"))
-           strlcpy(tptr, scheme + 22, sizeof(temp) - (size_t)(tptr - temp));
+           cupsCopyString(tptr, scheme + 22, sizeof(temp) - (size_t)(tptr - temp));
          else if (!strncmp(keyword, "txt_", 4))
          {
            const char *val = cupsGetOption(keyword + 4, service->num_txt, service->txt);
            if (val)
-             strlcpy(tptr, val, sizeof(temp) - (size_t)(tptr - temp));
+             cupsCopyString(tptr, val, sizeof(temp) - (size_t)(tptr - temp));
            else
              *tptr = '\0';
          }
@@ -2053,7 +2053,7 @@ exec_program(ippfind_srv_t *service,      /* I - Service */
   */
 
   if (strchr(args[0], '/') && !access(args[0], X_OK))
-    strlcpy(program, args[0], sizeof(program));
+    cupsCopyString(program, args[0], sizeof(program));
   else if (!cupsFileFind(args[0], getenv("PATH"), 1, program, sizeof(program)))
   {
     _cupsLangPrintf(stderr, _("ippfind: Unable to execute \"%s\": %s"),
@@ -2329,7 +2329,7 @@ list_service(ippfind_srv_t *service)      /* I - Service */
     if ((attr = ippFindAttribute(response, "printer-state-reasons",
                                  IPP_TAG_KEYWORD)) != NULL)
     {
-      strlcpy(preasons, ippGetString(attr, 0, NULL), sizeof(preasons));
+      cupsCopyString(preasons, ippGetString(attr, 0, NULL), sizeof(preasons));
 
       for (i = 1, count = ippGetCount(attr), ptr = preasons + strlen(preasons),
                end = preasons + sizeof(preasons) - 1;
@@ -2337,11 +2337,11 @@ list_service(ippfind_srv_t *service)    /* I - Service */
            i ++, ptr += strlen(ptr))
       {
         *ptr++ = ',';
-        strlcpy(ptr, ippGetString(attr, i, NULL), (size_t)(end - ptr + 1));
+        cupsCopyString(ptr, ippGetString(attr, i, NULL), (size_t)(end - ptr + 1));
       }
     }
     else
-      strlcpy(preasons, "none", sizeof(preasons));
+      cupsCopyString(preasons, "none", sizeof(preasons));
 
     ippDelete(response);
     httpClose(http);
index 95a041c41d333a50e102df7a2672fc93e287d350..4a10e14335303184362ac2e2853df249f1fe4d2c 100644 (file)
@@ -459,7 +459,7 @@ main(int  argc,                             /* I - Number of command-line args */
                usage();
               }
 
-              strlcpy(name, argv[i], sizeof(name));
+              cupsCopyString(name, argv[i], sizeof(name));
              if ((value = strchr(name, '=')) != NULL)
                *value++ = '\0';
              else
@@ -495,12 +495,12 @@ main(int  argc,                           /* I - Number of command-line args */
                  {
                    snprintf(filename, sizeof(filename), "%s/ipptool/%s.gz", cg->cups_datadir, argv[i]);
                    if (access(filename, 0))
-                     strlcpy(filename, argv[i], sizeof(filename));
+                     cupsCopyString(filename, argv[i], sizeof(filename));
                  }
                }
              }
               else
-               strlcpy(filename, argv[i], sizeof(filename));
+               cupsCopyString(filename, argv[i], sizeof(filename));
 
              _ippVarsSet(data.vars, "filename", filename);
 
@@ -1092,9 +1092,9 @@ do_monitor_printer_state(
 
            case IPP_TAG_BOOLEAN :
                if (ippGetBoolean(found, last))
-                 strlcpy(buffer, "true", sizeof(buffer));
+                 cupsCopyString(buffer, "true", sizeof(buffer));
                else
-                 strlcpy(buffer, "false", sizeof(buffer));
+                 cupsCopyString(buffer, "false", sizeof(buffer));
                break;
 
            case IPP_TAG_CHARSET :
@@ -1107,7 +1107,7 @@ do_monitor_printer_state(
            case IPP_TAG_TEXTLANG :
            case IPP_TAG_URI :
            case IPP_TAG_URISCHEME :
-               strlcpy(buffer, ippGetString(found, last, NULL), sizeof(buffer));
+               cupsCopyString(buffer, ippGetString(found, last, NULL), sizeof(buffer));
                break;
 
            default :
@@ -1720,7 +1720,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
             char       group_name[256],/* Parent attribute name */
                        *group_ptr;     /* Pointer into parent attribute name */
 
-           strlcpy(group_name, expect->name, sizeof(group_name));
+           cupsCopyString(group_name, expect->name, sizeof(group_name));
            if ((group_ptr = strchr(group_name, '/')) != NULL)
              *group_ptr = '\0';
 
@@ -1867,9 +1867,9 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
 
                case IPP_TAG_BOOLEAN :
                    if (ippGetBoolean(found, last))
-                     strlcpy(buffer, "true", sizeof(buffer));
+                     cupsCopyString(buffer, "true", sizeof(buffer));
                    else
-                     strlcpy(buffer, "false", sizeof(buffer));
+                     cupsCopyString(buffer, "false", sizeof(buffer));
                    break;
 
                case IPP_TAG_RESOLUTION :
@@ -1897,7 +1897,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
                case IPP_TAG_TEXTLANG :
                case IPP_TAG_URI :
                case IPP_TAG_URISCHEME :
-                   strlcpy(buffer, ippGetString(found, last, NULL), sizeof(buffer));
+                   cupsCopyString(buffer, ippGetString(found, last, NULL), sizeof(buffer));
                    break;
 
                default :
@@ -2511,7 +2511,7 @@ get_filename(const char *testfile,        /* I - Current test file */
     * Use the path as-is...
     */
 
-    strlcpy(dst, src, dstsize);
+    cupsCopyString(dst, src, dstsize);
   }
   else
   {
@@ -2519,13 +2519,13 @@ get_filename(const char *testfile,      /* I - Current test file */
     * Make path relative to testfile...
     */
 
-    strlcpy(dst, testfile, dstsize);
+    cupsCopyString(dst, testfile, dstsize);
     if ((dstptr = strrchr(dst, '/')) != NULL)
       dstptr ++;
     else
       dstptr = dst; /* Should never happen */
 
-    strlcpy(dstptr, src, dstsize - (size_t)(dstptr - dst));
+    cupsCopyString(dstptr, src, dstsize - (size_t)(dstptr - dst));
 
 #if _WIN32
     if (_access(dst, 0))
@@ -4372,7 +4372,7 @@ token_cb(_ipp_file_t    *f,               /* I - IPP file data */
 
       if (_ippFileReadToken(f, temp, sizeof(temp)))
       {
-        strlcpy(data->pause, temp, sizeof(data->pause));
+        cupsCopyString(data->pause, temp, sizeof(data->pause));
       }
       else
       {
@@ -5284,11 +5284,11 @@ token_cb(_ipp_file_t    *f,             /* I - IPP file data */
       data->last_expect    = NULL;
       data->file[0]        = '\0';
       data->ignore_errors  = data->def_ignore_errors;
-      strlcpy(data->name, f->filename, sizeof(data->name));
+      cupsCopyString(data->name, f->filename, sizeof(data->name));
       if ((ptr = strrchr(data->name, '.')) != NULL)
         *ptr = '\0';
       data->repeat_interval = 5000000;
-      strlcpy(data->resource, data->vars->resource, sizeof(data->resource));
+      cupsCopyString(data->resource, data->vars->resource, sizeof(data->resource));
       data->skip_previous = 0;
       data->pass_test     = 0;
       data->skip_test     = 0;
@@ -5986,7 +5986,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
           if ((!strcmp(value, "true") || !strcmp(value, "1")) == ippGetBoolean(attr, i))
           {
             if (!matchbuf[0])
-             strlcpy(matchbuf, value, matchlen);
+             cupsCopyString(matchbuf, value, matchlen);
 
            if (!(flags & IPPTOOL_WITH_ALL))
            {
@@ -6023,7 +6023,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
           if (!strcmp(value, temp))
           {
             if (!matchbuf[0])
-             strlcpy(matchbuf, value, matchlen);
+             cupsCopyString(matchbuf, value, matchlen);
 
            if (!(flags & IPPTOOL_WITH_ALL))
            {
@@ -6097,7 +6097,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
                         0, NULL, 0))
            {
              if (!matchbuf[0])
-               strlcpy(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
+               cupsCopyString(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
 
              if (!(flags & IPPTOOL_WITH_ALL))
              {
@@ -6125,7 +6125,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
            if (!compare_uris(value, get_string(attr, i, flags, temp, sizeof(temp))))
            {
              if (!matchbuf[0])
-               strlcpy(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
+               cupsCopyString(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
 
              if (!(flags & IPPTOOL_WITH_ALL))
              {
@@ -6190,7 +6190,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
             if (!result)
            {
              if (!matchbuf[0])
-               strlcpy(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
+               cupsCopyString(matchbuf, get_string(attr, i, flags, temp, sizeof(temp)), matchlen);
 
              if (!(flags & IPPTOOL_WITH_ALL))
              {
@@ -6249,7 +6249,7 @@ with_value(ipptool_test_t *data,  /* I - Test data */
            if (!regexec(&re, temp, 0, NULL, 0))
            {
              if (!matchbuf[0])
-               strlcpy(matchbuf, temp, matchlen);
+               cupsCopyString(matchbuf, temp, matchlen);
 
              if (!(flags & IPPTOOL_WITH_ALL))
              {
@@ -6514,7 +6514,7 @@ with_value_from(
          if (ippContainsString(fromattr, value))
          {
            if (!matchbuf[0])
-             strlcpy(matchbuf, value, matchlen);
+             cupsCopyString(matchbuf, value, matchlen);
          }
          else
          {
@@ -6536,7 +6536,7 @@ with_value_from(
             if (!compare_uris(value, ippGetString(fromattr, j, NULL)))
             {
               if (!matchbuf[0])
-                strlcpy(matchbuf, value, matchlen);
+                cupsCopyString(matchbuf, value, matchlen);
               break;
             }
           }