From: Jeff Trawick Date: Fri, 15 Sep 2000 21:23:46 +0000 (+0000) Subject: Handle a tag that appears at the start of a bucket. X-Git-Tag: APACHE_2_0_ALPHA_7~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0b638e33a38d3e2db716eb43c5215eb9cc60be5;p=apache Handle a tag that appears at the start of a bucket. Get rid of an endless loop (waiting for dptr2 to become NULL instead of AP_BRIGADE_SENTINEL()). Add to a to-do comment. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86239 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 389a75d108..79c02510d0 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -210,6 +210,10 @@ static ap_bucket *find_string(ap_bucket *dptr, const char *str, ap_bucket *end) * on what we are searching for. */ if (str[0] == '<') { + if (c - buf - strlen(str) == 0) { + /* first thing in bucket is tag; nothing to split */ + return dptr; + } dptr->split(dptr, c - buf - strlen(str)); } else { @@ -2294,12 +2298,17 @@ static void send_parsed_content(ap_bucket_brigade *bb, request_rec *r, if ((tagbuck = find_string(dptr, STARTING_SEQUENCE, AP_BRIGADE_LAST(bb))) != NULL) { dptr2 = tagbuck; dptr = tagbuck; - while (dptr2 && + while (dptr2 != AP_BRIGADE_SENTINEL(bb) && (endsec = find_string(dptr2, ENDING_SEQUENCE, AP_BRIGADE_LAST(bb))) == NULL) { dptr2 = AP_BUCKET_NEXT(dptr2); } if (endsec == NULL) { - /** No ending tag, needs to become an error bucket */ + /** XXX No ending tag, needs to become an error bucket + ** Tag could come in the next brigade (unless we've + ** received eos in this brigade). + ** + ** We're about to segfault. + **/ } /* At this point, everything between tagbuck and endsec is an SSI