From 549ba6a39aa0df78a610025f74f3a06503a70f67 Mon Sep 17 00:00:00 2001
From: "William A. Rowe Jr" <wrowe@apache.org>
Date: Thu, 6 Jul 2017 00:02:54 +0000
Subject: [PATCH] Correct string scope to prevent duplicated values for
 subsequent tokens.

Submitted by: wrowe
Backports: r1800919
Reviewed by: wrowe, jim, jchampion



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1800955 13f79535-47bb-0310-9956-ffa450edef68
---
 STATUS                        | 5 -----
 modules/aaa/mod_auth_digest.c | 4 ++--
 2 files changed, 2 insertions(+), 7 deletions(-)

#diff --git a/STATUS b/STATUS
#index cc2f9e5592c..6f4ef92edcf 100644
#--- a/STATUS
#+++ b/STATUS
#@@ -115,11 +115,6 @@ RELEASE SHOWSTOPPERS:
# PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
#   [ start all new proposals below, under PATCHES PROPOSED. ]
# 
#-   *) Correct string scope to prevent duplicated values for subsequent tokens.
#-      Submitted by: wrowe
#-      trunk patch: http://svn.apache.org/r1800919
#-      +1: wrowe, jim, jchampion
#-
#    *) Fix negotiation type parsing to be strict about "*", "*/*" and "type/*"
#       comparisons.
#       Submitted by: wrowe, Robert Święcki <robert swiecki.net>
Index: apache2-2.4.25/modules/aaa/mod_auth_digest.c
===================================================================
--- apache2-2.4.25.orig/modules/aaa/mod_auth_digest.c	2017-07-27 10:32:26.640621384 -0400
+++ apache2-2.4.25/modules/aaa/mod_auth_digest.c	2017-07-27 10:32:26.632621384 -0400
@@ -956,13 +956,13 @@ static int get_digest_rec(request_rec *r
 
         /* find value */
 
+        vv = 0;
         if (auth_line[0] == '=') {
             auth_line++;
             while (apr_isspace(auth_line[0])) {
                 auth_line++;
             }
 
-            vv = 0;
             if (auth_line[0] == '\"') {         /* quoted string */
                 auth_line++;
                 while (auth_line[0] != '\"' && auth_line[0] != '\0') {
@@ -981,8 +981,8 @@ static int get_digest_rec(request_rec *r
                     value[vv++] = *auth_line++;
                 }
             }
-            value[vv] = '\0';
         }
+        value[vv] = '\0';
 
         while (auth_line[0] != ',' && auth_line[0] != '\0') {
             auth_line++;
