]> granicus.if.org Git - apache/commitdiff
short-circuit on NULL
authorEric Covener <covener@apache.org>
Fri, 26 May 2017 21:40:11 +0000 (21:40 +0000)
committerEric Covener <covener@apache.org>
Fri, 26 May 2017 21:40:11 +0000 (21:40 +0000)
Submitted By: jchampion
CVEID: CVE-2017-7668

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1796350 13f79535-47bb-0310-9956-ffa450edef68

server/util.c

index 24062ca111d4718b78140666c64c0cd2c3d01bb6..5130a7b28ac576d4aeaddb251d787fd72e623672 100644 (file)
@@ -1680,10 +1680,8 @@ AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok)
 
     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) {