Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changes-entries/vhost-alias-interpolate-nul.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*) mod_vhost_alias: Reserve a byte for the terminating NUL when
interpolating VirtualDocumentRoot/VirtualScriptAlias, so a name of
a length that fills the buffer exactly cannot write one byte past
it. [arshiya tabasum]
5 changes: 4 additions & 1 deletion modules/mappers/mod_vhost_alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ static APR_INLINE int vhost_alias_checkspace(request_rec *r, char *buf,
"VirtualDocumentRoot expansion too large");
return HTTP_REQUEST_URI_TOO_LARGE;
}
if (*pdest + size > buf + HUGE_STRING_LEN) {
/* Reserve one byte for the terminating NUL: dest must never reach
* buf + HUGE_STRING_LEN, or the '\0' written here and at the end of
* vhost_alias_interpolate() lands one byte past the buffer. */
if (*pdest + size >= buf + HUGE_STRING_LEN) {
**pdest = '\0';
if (r->filename) {
r->filename = apr_pstrcat(r->pool, r->filename, buf, NULL);
Expand Down