From: Stefan Fritsch Date: Sun, 9 Dec 2012 13:33:29 +0000 (+0000) Subject: Merge r1398970, r1407853, r1398480, r1398478, r1411862, r1397320: X-Git-Tag: 2.4.4~347 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=253b88b0a9620be5c4ea62745c9bc5a983bef3fa;p=apache Merge r1398970, r1407853, r1398480, r1398478, r1411862, r1397320: 1398970: Use 'ap_strcasestr' instead of a strdup/str_tolower/strstr sequence 1407853: cppCheck: Suspicious condition. 1398480: cppcheck: arrayIndexThenCheck - change the order of the tests in order to avoid a potential out-of-bound access. 1398478: ccpcheck: duplicateExpression - 'vary_by_language' is tested twice 1411862: Use apr_is_empty_table() instead of getting a table and checking the value of the 'nelts' field. 1397320: remove extra ';' Submitted by: jailletc36 Reviewed by: jailletc36, minfrin, sf git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1418945 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index f11711f680..b69ae2f627 100644 --- a/STATUS +++ b/STATUS @@ -91,24 +91,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * (2/x) backport some easy patch to keep 2.4.x in line with trunk as much as possible - 1398970: Use 'ap_strcasestr' instead of a strdup/str_tolower/strstr sequence - 1407853: cppCheck: Suspicious condition. - 1398480: cppcheck: arrayIndexThenCheck - change the order of the tests in - order to avoid a potential out-of-bound access. - 1398478: ccpcheck: duplicateExpression - 'vary_by_language' is tested twice - 1411862: Use apr_is_empty_table() instead of getting a table and checking the - value of the 'nelts' field. - 1397320: remove extra ';' - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1398970 - http://svn.apache.org/viewvc?view=revision&revision=1407853 - http://svn.apache.org/viewvc?view=revision&revision=1398480 - http://svn.apache.org/viewvc?view=revision&revision=1398478 - http://svn.apache.org/viewvc?view=revision&revision=1411862 - http://svn.apache.org/viewvc?view=revision&revision=1397320 - 2.4.c patch: http://people.apache.org/~jailletc36/backport2.patch - +1: jailletc36, minfrin, sf - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/aaa/mod_authz_dbd.c b/modules/aaa/mod_authz_dbd.c index 86d3b5612a..2d4925f522 100644 --- a/modules/aaa/mod_authz_dbd.c +++ b/modules/aaa/mod_authz_dbd.c @@ -163,7 +163,7 @@ static int authz_dbd_login(request_rec *r, authz_dbd_cfg *cfg, /* OK, this is non-critical; we can just not-redirect */ } else if ((rv = apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, - &res, query, 0, r->user, NULL) == 0)) { + &res, query, 0, r->user, NULL)) == 0) { for (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1); rv != -1; rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) { diff --git a/modules/aaa/mod_authz_groupfile.c b/modules/aaa/mod_authz_groupfile.c index fb94168891..15bb60ffe1 100644 --- a/modules/aaa/mod_authz_groupfile.c +++ b/modules/aaa/mod_authz_groupfile.c @@ -176,7 +176,7 @@ static authz_status group_check_authorization(request_rec *r, return AUTHZ_DENIED; } - if (apr_table_elts(grpstatus)->nelts == 0) { + if (apr_is_empty_table(grpstatus)) { /* no groups available, so exit immediately */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01666) "Authorization of user %s to access %s failed, reason: " @@ -235,7 +235,7 @@ static authz_status filegroup_check_authorization(request_rec *r, return AUTHZ_DENIED; } - if (apr_table_elts(grpstatus)->nelts == 0) { + if (apr_is_empty_table(grpstatus)) { /* no groups available, so exit immediately */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01670) "Authorization of user %s to access %s failed, reason: " diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index d076cc45fd..aa08584102 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -1578,7 +1578,7 @@ DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r, err = (*repos_hooks->walk)(&ctx.w, DAV_INFINITY, &multi_status); if (err == NULL) { - *response = multi_status;; + *response = multi_status; } /* else: implies a 5xx status code occurred. */ } diff --git a/modules/filters/mod_filter.c b/modules/filters/mod_filter.c index 67cfd6bbc3..ca184f85f7 100644 --- a/modules/filters/mod_filter.c +++ b/modules/filters/mod_filter.c @@ -221,9 +221,7 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter) const char *str = apr_table_get(r->headers_out, "Cache-Control"); if (str) { - char *str1 = apr_pstrdup(r->pool, str); - ap_str_tolower(str1); - if (strstr(str1, "no-transform")) { + if (ap_strcasestr(str, "no-transform")) { /* can't use this provider; try next */ continue; } @@ -278,7 +276,6 @@ static apr_status_t filter_harness(ap_filter_t *f, apr_bucket_brigade *bb) apr_status_t ret; #ifndef NO_PROTOCOL const char *cachecontrol; - char *str; #endif harness_ctx *ctx = f->ctx; ap_filter_rec_t *filter = f->frec; @@ -304,9 +301,7 @@ static apr_status_t filter_harness(ap_filter_t *f, apr_bucket_brigade *bb) cachecontrol = apr_table_get(f->r->headers_out, "Cache-Control"); if (cachecontrol) { - str = apr_pstrdup(f->r->pool, cachecontrol); - ap_str_tolower(str); - if (strstr(str, "no-transform")) { + if (ap_strcasestr(cachecontrol, "no-transform")) { ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } diff --git a/modules/mappers/mod_imagemap.c b/modules/mappers/mod_imagemap.c index 9edb3e9f7e..8057e29608 100644 --- a/modules/mappers/mod_imagemap.c +++ b/modules/mappers/mod_imagemap.c @@ -176,7 +176,7 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2]) int i, numverts, crossings = 0; double x = point[X], y = point[Y]; - for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS; + for (numverts = 0; numverts < MAXVERTS && pgon[numverts][X] != -1; numverts++) { /* just counting the vertexes */ } diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c index 5f3232b8a5..4a3a45730e 100644 --- a/modules/mappers/mod_negotiation.c +++ b/modules/mappers/mod_negotiation.c @@ -2606,7 +2606,7 @@ static void set_neg_headers(request_rec *r, negotiation_state *neg, } if (neg->is_transparent || vary_by_type || vary_by_language || - vary_by_language || vary_by_charset || vary_by_encoding) { + vary_by_charset || vary_by_encoding) { apr_table_mergen(hdrs, "Vary", 2 + apr_pstrcat(r->pool, neg->is_transparent ? ", negotiate" : "",