You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2019/03/28 18:22:23 UTC

svn commit: r1856500 - /httpd/httpd/trunk/modules/cache/cache_util.c

Author: ylavic
Date: Thu Mar 28 18:22:23 2019
New Revision: 1856500

URL: http://svn.apache.org/viewvc?rev=1856500&view=rev
Log:
mod_cache: follow up to r1856493: always terminate cache_strqtok() returns.

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1856500&r1=1856499&r2=1856500&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Thu Mar 28 18:22:23 2019
@@ -931,6 +931,7 @@ CACHE_DECLARE(char *)ap_cache_generate_n
 apr_status_t cache_strqtok(char *str, char **token, char **arg, char **last)
 {
 #define CACHE_TOKEN_SEPS "\t ,"
+    apr_status_t rv = APR_SUCCESS;
     int quoted = 0;
     char *wpos;
 
@@ -988,7 +989,6 @@ apr_status_t cache_strqtok(char *str, ch
         }
         *wpos++ = *str;
     }
-    *wpos = '\0';
 
     /* anything after should be trailing OWS or comma */
     for (; *str; ++str) {
@@ -997,12 +997,14 @@ apr_status_t cache_strqtok(char *str, ch
             break;
         }
         if (*str != '\t' && *str != ' ') {
-            return APR_EINVAL;
+            rv = APR_EINVAL;
+            break;
         }
     }
-    *last = str;
 
-    return APR_SUCCESS;
+    *wpos = '\0';
+    *last = str;
+    return rv;
 }
 
 /**