]> granicus.if.org Git - apache/commitdiff
Allocate only as much data as we need to hold token values in the
authorBrian Pane <brianp@apache.org>
Sun, 13 Jan 2002 06:06:52 +0000 (06:06 +0000)
committerBrian Pane <brianp@apache.org>
Sun, 13 Jan 2002 06:06:52 +0000 (06:06 +0000)
"<!--#if" processing code, rather always allocating an 8KB structure

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

modules/filters/mod_include.c

index 1b7b151637e5ff482ddec0ed2df35b4470dcf4c4..525788d41191454ab009efb9d2a2bd3a5689df58 100644 (file)
@@ -1645,12 +1645,9 @@ enum token_type {
 };
 struct token {
     enum token_type type;
-    char value[MAX_STRING_LEN];
+    char* value;
 };
 
-/* there is an implicit assumption here that string is at most MAX_STRING_LEN-1
- * characters long...
- */
 static const char *get_ptoken(request_rec *r, const char *string, 
                               struct token *token, int *unmatched)
 {
@@ -1659,6 +1656,8 @@ static const char *get_ptoken(request_rec *r, const char *string,
     char qs = 0;
     int tkn_fnd = 0;
 
+    token->value = NULL;
+
     /* Skip leading white space */
     if (string == (char *) NULL) {
         return (char *) NULL;
@@ -1735,6 +1734,8 @@ static const char *get_ptoken(request_rec *r, const char *string,
         break;
     }
     /* We should only be here if we are in a string */
+    token->value = apr_palloc(r->pool, strlen(string) + 2); /* 2 for ch plus
+                                                               trailing null */
     if (!qs) {
         token->value[next++] = ch;
     }