]> granicus.if.org Git - apache/commitdiff
respect const-ness of string argument to ap_expr_string()
authorJeff Trawick <trawick@apache.org>
Tue, 15 Sep 2009 12:59:12 +0000 (12:59 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 15 Sep 2009 12:59:12 +0000 (12:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@815304 13f79535-47bb-0310-9956-ffa450edef68

server/util_expr.c

index 65865b0c6e5dac94093ee7388207545a33a7cd98..3acc8a3182216e9edc48819bb44940ba158ab6cd 100644 (file)
@@ -901,7 +901,7 @@ AP_DECLARE_NONSTD(const char*) ap_expr_string(request_rec *r,
     /* a default string evaluator: support headers and env */
     const char *ret = str;
     ap_regmatch_t match[3];
-    char *p;
+    const char *p;
 
     ap_assert(isvar != NULL);
     if (ap_regexec(isvar, str, 3, match, 0) == 0) {
@@ -934,13 +934,13 @@ AP_DECLARE_NONSTD(const char*) ap_expr_string(request_rec *r,
 
     /* copy wholesale from mod_rewrite to support its %{varname} vars */
     else if ((str[0] == '%') && (str[1] == '{')
-             && (p = ap_strchr(str, '}'), p != NULL)) {
-        char *var;
+             && (p = ap_strchr_c(str, '}'), p != NULL)) {
+        char *ch, *var;
         apr_time_exp_t tm;
 
         var = apr_pstrndup(r->pool, str+2, p-str-3);
-        for (p = var; *p; ++p) {
-            *p = apr_toupper(*p);
+        for (ch = var; *ch; ++ch) {
+            *ch = apr_toupper(*ch);
         }
 
         switch (strlen(var)) {