From: Colm MacCarthaigh Date: Mon, 23 Jan 2006 20:16:54 +0000 (+0000) Subject: Merge r179622 and r280114 from trunk: X-Git-Tag: 2.0.56~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cae680875dad888c1292326461df7a6e335b471;p=thirdparty%2Fapache%2Fhttpd.git Merge r179622 and r280114 from trunk: * mod_mime_magic: Handle CRLF-format magic files so that it works with the default installation on Windows. * rewrite CR mitigation logic to wipe out any trailing white space Suggested by: wrowe Submitted by: trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@371646 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 82522c4aedb..a5b5cbdae6a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.0.56 + *) mod_mime_magic: Handle CRLF-format magic files so that it works with + the default installation on Windows. [Jeff Trawick] + *) Write message to error log if AuthGroupFile cannot be opened. PR 37566. [Rüdiger Plüm] diff --git a/STATUS b/STATUS index 0888db41796..c7c0af6e2f0 100644 --- a/STATUS +++ b/STATUS @@ -133,14 +133,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: http://svn.apache.org/viewcvs?view=rev&rev=154319 +1: stoddard, striker, wrowe (as corrected in subsequent patches) - *) mod_mime_magic: Handle CRLF-format^H^H^H^H^H^H^H magic files - with any trailing whitespace so that it works with the - default installation on Windows. - http://svn.apache.org/viewcvs?rev=179622&view=rev - http://svn.apache.org/viewcvs?rev=280114&view=rev - +1: trawick, wrowe, colm - backported 280114 to 2.2.x branch already - *) mod_dav: Fix a null pointer dereference in an error code path during the handling of MKCOL. Trunk version of patch: diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c index 0b18f56086e..9443295a289 100644 --- a/modules/metadata/mod_mime_magic.c +++ b/modules/metadata/mod_mime_magic.c @@ -947,12 +947,17 @@ static int apprentice(server_rec *s, apr_pool_t *p) /* parse it */ for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) { int ws_offset; - - /* delete newline */ - if (line[0]) { - line[strlen(line) - 1] = '\0'; - } - + char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an + * "empty" line contains a '\n' + */ + + /* delete newline and any other trailing whitespace */ + while (last >= line + && apr_isspace(*last)) { + *last = '\0'; + --last; + } + /* skip leading whitespace */ ws_offset = 0; while (line[ws_offset] && apr_isspace(line[ws_offset])) {