diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-10-01 03:01:10 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-10-01 03:01:10 +0000 |
commit | 5a9febac19255ab8aea598449ea63bda730b2fe0 (patch) | |
tree | 1ca7eead0982e5b8893cadd8b2215d1ea96171f7 /cgi-bin | |
parent | 37e7e6e0b27c7db3be8e160e87a63fec66e0fcca (diff) | |
download | cups-5a9febac19255ab8aea598449ea63bda730b2fe0.tar.gz |
Merge changes from CUPS 1.7svn-r10629.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3933 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/admin.c | 10 | ||||
-rw-r--r-- | cgi-bin/classes.c | 2 | ||||
-rw-r--r-- | cgi-bin/help-index.c | 4 | ||||
-rw-r--r-- | cgi-bin/ipp-var.c | 9 | ||||
-rw-r--r-- | cgi-bin/jobs.c | 2 | ||||
-rw-r--r-- | cgi-bin/printers.c | 2 | ||||
-rw-r--r-- | cgi-bin/search.c | 14 |
7 files changed, 22 insertions, 21 deletions
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index d0f488e5a..84c9d9c90 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -962,13 +962,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)) - strcpy(make, "HP"); + strlcpy(make, "HP", sizeof(make)); else if (!_cups_strncasecmp(make, "phaser", 6)) - strcpy(make, "Xerox"); + strlcpy(make, "Xerox", sizeof(make)); else if (!_cups_strncasecmp(make, "stylus", 6)) - strcpy(make, "Epson"); + strlcpy(make, "Epson", sizeof(make)); else - strcpy(make, "Generic"); + strlcpy(make, "Generic", sizeof(make)); if (!cgiGetVariable("CURRENT_MAKE")) cgiSetVariable("CURRENT_MAKE", make); @@ -4187,7 +4187,7 @@ get_option_value( if (bufptr == buffer || (bufend - bufptr) < 2) return (NULL); - strcpy(bufptr, "}"); + memcpy(bufptr, "}", 2); } return (buffer); diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index 1be7664ca..8d42e5cda 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -380,7 +380,7 @@ show_all_classes(http_t *http, /* I - Connection to server */ sprintf(val, "%d", count); cgiSetVariable("TOTAL", val); - if ((var = cgiGetVariable("ORDER")) != NULL) + if ((var = cgiGetVariable("ORDER")) != NULL && *var) ascending = !_cups_strcasecmp(var, "asc"); else ascending = 1; diff --git a/cgi-bin/help-index.c b/cgi-bin/help-index.c index c48ffeb4d..08586a0b1 100644 --- a/cgi-bin/help-index.c +++ b/cgi-bin/help-index.c @@ -3,7 +3,7 @@ * * Online help index routines for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -910,7 +910,7 @@ help_load_file( node = NULL; offset = 0; - strcpy(section, "Other"); + strlcpy(section, "Other", sizeof(section)); while (cupsFileGets(fp, line, sizeof(line))) { diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 1251e89a6..75fb84452 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -129,7 +129,7 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */ *nameptr = '\0'; if (!strncmp(name, "printer_state_history", 21)) - strcpy(name, "printer_state_history"); + strlcpy(name, "printer_state_history", sizeof(name)); /* * Possibly add it to the list of attributes... @@ -1432,7 +1432,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/"); - if ((which_jobs = cgiGetVariable("which_jobs")) != NULL) + if ((which_jobs = cgiGetVariable("which_jobs")) != NULL && *which_jobs) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs", NULL, which_jobs); @@ -1480,10 +1480,11 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ if (first < 0) first = 0; - if ((var = cgiGetVariable("ORDER")) != NULL) + if ((var = cgiGetVariable("ORDER")) != NULL && *var) ascending = !_cups_strcasecmp(var, "asc"); else - ascending = !which_jobs || !_cups_strcasecmp(which_jobs, "not-completed"); + ascending = !which_jobs || !*which_jobs || + !_cups_strcasecmp(which_jobs, "not-completed"); section = cgiGetVariable("SECTION"); diff --git a/cgi-bin/jobs.c b/cgi-bin/jobs.c index 30aefa667..bfb354885 100644 --- a/cgi-bin/jobs.c +++ b/cgi-bin/jobs.c @@ -182,7 +182,7 @@ do_job_op(http_t *http, /* I - HTTP connection */ char url[1024]; /* Encoded URL */ - strcpy(url, "5;URL="); + strlcpy(url, "5;URL=", sizeof(url)); cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6); cgiSetVariable("refresh_page", url); } diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index 4230eec19..36e992025 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -397,7 +397,7 @@ show_all_printers(http_t *http, /* I - Connection to server */ sprintf(val, "%d", count); cgiSetVariable("TOTAL", val); - if ((var = cgiGetVariable("ORDER")) != NULL) + if ((var = cgiGetVariable("ORDER")) != NULL && *var) ascending = !_cups_strcasecmp(var, "asc"); else ascending = 1; diff --git a/cgi-bin/search.c b/cgi-bin/search.c index f8d6c797f..94150de58 100644 --- a/cgi-bin/search.c +++ b/cgi-bin/search.c @@ -3,7 +3,7 @@ * * Search routines for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -208,7 +208,7 @@ cgiCompileSearch(const char *query) /* I - Query string */ * Add the prefix string... */ - strcpy(sptr, prefix); + memcpy(sptr, prefix, strlen(prefix) + 1); sptr += strlen(sptr); /* @@ -249,16 +249,16 @@ cgiCompileSearch(const char *query) /* I - Query string */ return (NULL); } - strcpy(sptr, ".*|.*"); + memcpy(sptr, ".*|.*", 6); sptr += 5; - strcpy(sptr, lword2); + memcpy(sptr, lword2, strlen(lword2) + 1); sptr += strlen(sptr); - strcpy(sptr, ".*"); + memcpy(sptr, ".*", 3); sptr += 2; - strcpy(sptr, lword); + memcpy(sptr, lword, strlen(lword) + 1); sptr += strlen(sptr); free(lword); @@ -287,7 +287,7 @@ cgiCompileSearch(const char *query) /* I - Query string */ free(lword); if (sptr > s) - strcpy(sptr, ".*"); + memcpy(sptr, ".*", 3); else { /* |