From e0fec7d48dab1924c5a6b48819ce1cf420733f62 Mon Sep 17 00:00:00 2001
From: Ruediger Pluem <rpluem@apache.org>
Date: Wed, 18 Aug 2021 14:35:41 +0000
Subject: [PATCH] * Follow the same logic that is used for calculating the
 length

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892418 13f79535-47bb-0310-9956-ffa450edef68
---
 server/util.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/server/util.c b/server/util.c
index e44e39afe3e..6bc5063bc39 100644
--- a/server/util.c
+++ b/server/util.c
@@ -2621,13 +2621,12 @@ AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring)
      * in front of every " that doesn't already have one.
      */
     while (*inchr != '\0') {
-        while ((*inchr == '\\') && (inchr[1] != '\0')) {
-            *outchr++ = *inchr++;
-            *outchr++ = *inchr++;
-        }
         if (*inchr == '"') {
             *outchr++ = '\\';
         }
+        if ((*inchr == '\\') && (inchr[1] != '\0')) {
+            *outchr++ = *inchr++;
+        }
         if (*inchr != '\0') {
             *outchr++ = *inchr++;
         }
