From a585e36e06a53170be6d2d462ceb5b30b8382988 Mon Sep 17 00:00:00 2001
From: Jim Jagielski <jim@apache.org>
Date: Tue, 30 May 2017 12:28:20 +0000
Subject: [PATCH] Merge r1796350 from trunk:

short-circuit on NULL

Submitted By: jchampion


Submitted by: covener
Reviewed by: covener, ylavic, jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1796856 13f79535-47bb-0310-9956-ffa450edef68
---
 STATUS        | 4 ----
 server/util.c | 6 ++----
 2 files changed, 2 insertions(+), 8 deletions(-)

#diff --git a/STATUS b/STATUS
#index 456596a6160..87abfa95d81 100644
#--- a/STATUS
#+++ b/STATUS
#@@ -120,10 +120,6 @@ RELEASE SHOWSTOPPERS:
# PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
#   [ start all new proposals below, under PATCHES PROPOSED. ]
# 
#-  *) core: Terminate token processing on NULL.
#-     trunk patch: http://svn.apache.org/r1796350
#-     2.4.x patch: svn merge -c 1796350 ^/httpd/httpd/trunk .
#-     +1: covener, ylavic, jim
# 
# 
# PATCHES PROPOSED TO BACKPORT FROM TRUNK:
Index: apache2-2.4.7/server/util.c
===================================================================
--- apache2-2.4.7.orig/server/util.c	2017-06-26 08:04:48.041609150 -0400
+++ apache2-2.4.7/server/util.c	2017-06-26 08:04:48.037609107 -0400
@@ -1537,10 +1537,8 @@ AP_DECLARE(int) ap_find_token(apr_pool_t
 
     s = (const unsigned char *)line;
     for (;;) {
-        /* find start of token, skip all stop characters, note NUL
-         * isn't a token stop, so we don't need to test for it
-         */
-        while (TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) {
+        /* find start of token, skip all stop characters */
+        while (*s && TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) {
             ++s;
         }
         if (!*s) {
