]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* modules/proxy/mod_proxy_beacon.c (beacon_resolve, beacon_parse_url,
authorJoe Orton <jorton@apache.org>
Fri, 5 Jun 2026 16:54:38 +0000 (16:54 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 5 Jun 2026 16:54:38 +0000 (16:54 +0000)
  beacon_verify): Use ap_strstr_c and ap_strchr_c for const-correct
  string searches, fixing -Werror=discarded-qualifiers errors.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935040 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_beacon.c

index a0c9567ca5614567ca0a21fee44221d3b0152676..3cbbd0dd3529a00655f2dd790568bdb2071118ac 100644 (file)
@@ -415,7 +415,7 @@ static apr_status_t beacon_resolve(apr_pool_t *p, const char *url,
 
     if (url && *url) {
         const char *hostport = url, *sep;
-        if ((sep = strstr(url, "://")) != NULL) {
+        if ((sep = ap_strstr_c(url, "://")) != NULL) {
             hostport = sep + 3;
         }
         rv = apr_parse_addr_port(&host, &scope, &port, hostport, p);
@@ -877,7 +877,7 @@ static int beacon_parse_url(const char *msg, char *buf, apr_size_t buflen)
             return (i > 0);
         }
         /* advance to the next space-separated token */
-        p = strchr(p, ' ');
+        p = ap_strchr_c(p, ' ');
         if (p) {
             p++;
         }
@@ -940,7 +940,7 @@ static int beacon_verify(beacon_ctx_t *ctx, const char *msg, apr_time_t now,
     apr_int64_t ts, skew, delta;
 
     /* Locate the last " mac=" -- the MAC covers everything before it. */
-    for (p = msg; (p = strstr(p, " mac=")) != NULL; p += 5) {
+    for (p = msg; (p = ap_strstr_c(p, " mac=")) != NULL; p += 5) {
         macp = p;
     }
     if (!macp) {
@@ -971,7 +971,7 @@ static int beacon_verify(beacon_ctx_t *ctx, const char *msg, apr_time_t now,
      * less than a second apart still have strictly-increasing timestamps for
      * the caller's per-url check. */
     tsp = NULL;
-    for (p = msg; (p = strstr(p, "ts=")) != NULL && p < macp; p += 3) {
+    for (p = msg; (p = ap_strstr_c(p, "ts=")) != NULL && p < macp; p += 3) {
         /* token-start: beginning of message or preceded by a space */
         if (p == msg || *(p - 1) == ' ') {
             tsp = p;