]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1491700, r1862200 from trunk:
authorJoe Orton <jorton@apache.org>
Fri, 5 Jul 2019 11:26:12 +0000 (11:26 +0000)
committerJoe Orton <jorton@apache.org>
Fri, 5 Jul 2019 11:26:12 +0000 (11:26 +0000)
According to comment in 'magic_rsl_add' and to the way 'magic_rsl_printf' manages its buffer, I think that this memory should be apr_pstrdup'ed.

This has been like that forever, but seems broken to me.

Untested.

* docs/conf/magic: Allow mod_mime_magic to return "audio/x-wav" for
  WAV files, and omit returning "audio/unknown" for other RIFF
  format files.  Having a MIME type defined on a continuation line
  *and* the preceding top-level match breaks mod_mime_magic, which
  treats the second result "printed" as the MIME encoding. Neither
  audio/x-wav nor audio/unknown are IANA registered, though Firefox
  and Chrome both appear to recognize the former.  Since the RIFF
  format can contain non-audio media, returning audio/unknown as
  a fallback for all RIFF files appears to be bogus anyway.

Submitted by: Àngel Ollé Blázquez <aollebla redhat.com>
Submitted by: jailletc36
Reviewed by: jorton, jim, icing

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1862604 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/conf/magic
modules/metadata/mod_mime_magic.c

diff --git a/CHANGES b/CHANGES
index be97a1b63a3a5dfb017b84728291caad22998b80..21707c50039ee421ba4c873015e234b444925782 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,13 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.40
 
+  *) mod_mime_magic: Fix possible corruption of returned strings.
+     [Christophe Jaillet]
+
+  *) Default "conf/magic": Fix pattern for "audio/x-wav" for WAV files,
+     remove "audio/unknown" pattern for other RIFF files.
+     [Àngel Ollé Blázquez <aollebla redhat.com>]
+
   *) mod_proxy_http2: fixing a potential NULL pointer use in logging.
      [Christophe Jaillet <christophe.jaillet wanadoo.fr>, Dr Silvio Cesare InfoSect]
 
index 7c56119e9a59290f97eee23bbf483ee8a348639e..bc891d93e667cbcc79381c1d85ee06305d7e4505 100644 (file)
@@ -87,7 +87,7 @@
 # Microsoft WAVE format (*.wav)
 # [GRR 950115:  probably all of the shorts and longs should be leshort/lelong]
 #                                      Microsoft RIFF
-0      string          RIFF            audio/unknown
+0      string          RIFF            
 #                                      - WAVE format
 >8     string          WAVE            audio/x-wav
 # MPEG audio.
index 22dadaf6fbd820f43ed0d1327c39c3ec19709b18..c12529acfa1f3f90cb05d91b3db742fa8a54159e 100644 (file)
@@ -606,7 +606,7 @@ static int magic_rsl_putchar(request_rec *r, char c)
     /* high overhead for 1 char - just hope they don't do this much */
     str[0] = c;
     str[1] = '\0';
-    return magic_rsl_add(r, str);
+    return magic_rsl_add(r, apr_pstrdup(r->pool, str));
 }
 
 /* allocate and copy a contiguous string from a result string list */