]> granicus.if.org Git - apache/commitdiff
Revert change in order to apply a better solution.
authorChristophe Jaillet <jailletc36@apache.org>
Wed, 22 May 2013 19:45:23 +0000 (19:45 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Wed, 22 May 2013 19:45:23 +0000 (19:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1485379 13f79535-47bb-0310-9956-ffa450edef68

server/util.c

index 9a795eac37555d13d3c651ca709a9ac520ba26b5..c696fb7350e5e905d8fd149770b6f243f3285da9 100644 (file)
@@ -1910,26 +1910,12 @@ AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
     char *ret;
     unsigned char *d;
     const unsigned char *s;
-    apr_size_t length = 0;
 
     if (!str) {
         return NULL;
     }
 
-    /* First, compute the space needed for the escaped string.
-     * This could be tweaked a bit for '\b', '\n'... These characters
-     * should not be common, so do not bother. */
-    s = (const unsigned char *)str;
-    for (; *s; ++s) {
-        if (TEST_CHAR(*s, T_ESCAPE_LOGITEM)) {
-            length += 4;        /* for '\\' + c2x() */
-        }
-        else {
-            length++;
-        }
-    }
-    
-    ret = apr_palloc(p, length + 1);
+    ret = apr_palloc(p, 4 * strlen(str) + 1); /* Be safe */
     d = (unsigned char *)ret;
     s = (const unsigned char *)str;
     for (; *s; ++s) {