From: Bradley Nicholes Date: Wed, 7 Apr 2004 21:43:01 +0000 (+0000) Subject: Don't allocation large buffers on the stack to avoid over-running a fixed length... X-Git-Tag: pre_ajp_proxy~405 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbe1841ea934787484cf64d6dbba44d9ea896633;p=apache Don't allocation large buffers on the stack to avoid over-running a fixed length stack when ap_build_cont_config() is called recursively (ie. nested blocks). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103290 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/config.c b/server/config.c index d50cfae1a7..52ebfbe028 100644 --- a/server/config.c +++ b/server/config.c @@ -985,11 +985,17 @@ AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p, ap_directive_t **curr_parent, char *orig_directive) { - char l[MAX_STRING_LEN]; + char *l; char *bracket; const char *retval; ap_directive_t *sub_tree = NULL; + /* Since this function can be called recursively, allocate + * the temporary 8k string buffer from the temp_pool rather + * than the stack to avoid over-running a fixed length stack. + */ + l = apr_palloc(temp_pool, MAX_STRING_LEN); + bracket = apr_pstrcat(p, orig_directive + 1, ">", NULL); while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) { if (!memcmp(l, "