]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.3' into PHP-7.4
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 2 Mar 2020 14:06:14 +0000 (15:06 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 2 Mar 2020 14:08:50 +0000 (15:08 +0100)
* PHP-7.3:
  Update libmagic.patch

1  2 
ext/fileinfo/generate_patch.sh
ext/fileinfo/libmagic.patch

index 325a321d74f9d8445387aa7e3eb5d9e943698ff6,3c0b4cf2f5c05be72273ddf3e6dc0875a932386c..5431ca5e4f4a20f4026afc174c733f5c0fc833fb
mode 100755,100644..100755
index 13c89c87154d8a0887dc06ca026990d589b22ad2,0b545efd68d62ccb9fb4f04368f6dc5981f1a957..c3669d9d6e40eb418fc1100724469db9f753b535
@@@ -1,6 -1,24 +1,6 @@@
  diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
 ---- libmagic.orig/apprentice.c        2018-03-11 01:46:42.000000000 +0100
 -+++ libmagic/apprentice.c     2020-02-26 09:55:13.842042400 +0100
 -@@ -2,7 +2,7 @@
 -  * Copyright (c) Ian F. Darwin 1986-1995.
 -  * Software written by Ian F. Darwin and others;
 -  * maintained 1995-present by Christos Zoulas and others.
 -- * 
 -+ *
 -  * Redistribution and use in source and binary forms, with or without
 -  * modification, are permitted provided that the following conditions
 -  * are met:
 -@@ -12,7 +12,7 @@
 -  * 2. Redistributions in binary form must reproduce the above copyright
 -  *    notice, this list of conditions and the following disclaimer in the
 -  *    documentation and/or other materials provided with the distribution.
 -- *  
 -+ *
 -  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 -  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 -  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 +--- libmagic.orig/apprentice.c        2019-02-20 03:35:27.000000000 +0100
- +++ libmagic/apprentice.c     2019-06-29 22:00:36.200336685 +0200
+++++ libmagic/apprentice.c     2020-03-02 15:04:23.670412600 +0100
  @@ -29,6 +29,8 @@
    * apprentice - make one pass through /etc/magic, learning its secrets.
    */
                m->str_range = swap4(m->str_range);
                m->str_flags = swap4(m->str_flags);
        }
 -@@ -3348,7 +3349,7 @@
 -      }
 - }
 - 
 --protected size_t 
 -+protected size_t
 - file_pstring_length_size(const struct magic *m)
 - {
 -      switch (m->str_flags & PSTRING_LEN) {
 -diff -u libmagic.orig/apptype.c libmagic/apptype.c
 ---- libmagic.orig/apptype.c   2011-09-07 23:57:15.000000000 +0200
 -+++ libmagic/apptype.c        2020-02-26 09:55:13.843047200 +0100
 -@@ -1,15 +1,15 @@
 - /*
 -  * Adapted from: apptype.c, Written by Eberhard Mattes and put into the
 -  * public domain
 -- * 
 -+ *
 -  * Notes: 1. Qualify the filename so that DosQueryAppType does not do extraneous
 -  * searches.
 -- * 
 -+ *
 -  * 2. DosQueryAppType will return FAPPTYP_DOS on a file ending with ".com"
 -  * (other than an OS/2 exe or Win exe with this name). Eberhard Mattes
 -  * remarks Tue, 6 Apr 93: Moreover, it reports the type of the (new and very
 -  * bug ridden) Win Emacs as "OS/2 executable".
 -- * 
 -+ *
 -  * 3. apptype() uses the filename if given, otherwise a tmp file is created with
 -  * the contents of buf. If buf is not the complete file, apptype can
 -  * incorrectly identify the exe type. The "-z" option of "file" is the reason
 -@@ -18,10 +18,10 @@
 - 
 - /*
 -  * amai: Darrel Hankerson did the changes described here.
 -- * 
 -+ *
 -  * It remains to check the validity of comments (2.) since it's referred to an
 -  * "old" OS/2 version.
 -- * 
 -+ *
 -  */
 - 
 - #include "file.h"
  diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
 ---- libmagic.orig/ascmagic.c  2017-11-02 21:25:39.000000000 +0100
 -+++ libmagic/ascmagic.c       2020-02-26 09:55:13.845043300 +0100
 -@@ -90,7 +90,7 @@
 +--- libmagic.orig/ascmagic.c  2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/ascmagic.c       2019-06-29 20:07:54.070996657 +0200
+++++ libmagic/ascmagic.c       2020-03-02 15:04:23.671413500 +0100
 +@@ -96,7 +96,7 @@
                rv = file_ascmagic_with_encoding(ms, &bb,
                    ubuf, ulen, code, type, text);
   
        return rv;
   }
  diff -u libmagic.orig/buffer.c libmagic/buffer.c
 ---- libmagic.orig/buffer.c    2018-03-11 01:46:42.000000000 +0100
 -+++ libmagic/buffer.c 2020-02-26 09:55:13.846042600 +0100
 -@@ -31,7 +31,11 @@
 +--- libmagic.orig/buffer.c    2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/buffer.c 2019-06-29 22:07:44.306641133 +0200
+++++ libmagic/buffer.c 2020-03-02 15:04:23.672412500 +0100
 +@@ -31,19 +31,23 @@
   #endif       /* lint */
   
   #include "magic.h"
        }
   
  diff -u libmagic.orig/cdf.c libmagic/cdf.c
 ---- libmagic.orig/cdf.c       2018-03-11 01:46:42.000000000 +0100
 -+++ libmagic/cdf.c    2020-02-26 09:55:13.847043900 +0100
 +--- libmagic.orig/cdf.c       2019-02-20 03:35:27.000000000 +0100
- +++ libmagic/cdf.c    2019-06-29 20:07:54.074996599 +0200
+++++ libmagic/cdf.c    2020-03-02 15:04:23.674415200 +0100
  @@ -43,7 +43,17 @@
   #include <err.h>
   #endif
        *maxcount = 0;
        *info = NULL;
        return NULL;
- @@ -1102,7 +1084,7 @@
 -@@ -1003,8 +989,9 @@
++@@ -1013,8 +995,9 @@
+                               goto out;
+                       }
+                       nelements = CDF_GETUINT32(q, 1);
+ -                     if (nelements == 0) {
+ -                             DPRINTF(("CDF_VECTOR with nelements == 0\n"));
+ +                     if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
+ +                             DPRINTF(("CDF_VECTOR with nelements == %"
+ +                                 SIZE_T_FORMAT "u\n", nelements));
+                               goto out;
+                       }
+                       slen = 2;
 -@@ -1046,8 +1033,6 @@
++@@ -1056,8 +1039,6 @@
+                                       goto out;
+                               inp += nelem;
+                       }
+ -                     DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
+ -                         nelements));
+                       for (j = 0; j < nelements && i < sh.sh_properties;
+                           j++, i++)
+                       {
 -@@ -1092,7 +1077,7 @@
++@@ -1102,7 +1083,7 @@
        }
        return 0;
   out:
        *info = NULL;
        *count = 0;
        *maxcount = 0;
- @@ -1394,7 +1376,7 @@
 -@@ -1383,7 +1368,7 @@
++@@ -1394,7 +1375,7 @@
        cdf_directory_t *d;
        char name[__arraycount(d->d_name)];
        cdf_stream_t scn;
   
        static const char *types[] = { "empty", "user storage",
            "user stream", "lockbytes", "property", "root storage" };
- @@ -1436,7 +1418,7 @@
 -@@ -1425,7 +1410,7 @@
++@@ -1436,7 +1417,7 @@
                                break;
                        }
                        cdf_dump_stream(&scn);
                        break;
                default:
                        break;
- @@ -1449,7 +1431,7 @@
 -@@ -1438,7 +1423,7 @@
++@@ -1449,7 +1430,7 @@
   cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
   {
        cdf_timestamp_t tp;
        char buf[64];
        size_t i, j;
   
- @@ -1534,7 +1516,7 @@
 -@@ -1523,7 +1508,7 @@
++@@ -1534,7 +1515,7 @@
        (void)fprintf(stderr, "Class %s\n", buf);
        (void)fprintf(stderr, "Count %d\n", ssi.si_count);
        cdf_dump_property_info(info, count);
   }
   
   
- @@ -1555,7 +1537,7 @@
 -@@ -1544,7 +1529,7 @@
++@@ -1555,7 +1536,7 @@
                    cdf_u16tos8(sbuf, ce[i].ce_namlen, ce[i].ce_name),
                    cdf_ctime(&ts.tv_sec, tbuf));
        }
   
   #endif
  diff -u libmagic.orig/cdf.h libmagic/cdf.h
 ---- libmagic.orig/cdf.h       2017-03-09 17:57:17.000000000 +0100
 -+++ libmagic/cdf.h    2020-02-26 09:55:13.848043100 +0100
 +--- libmagic.orig/cdf.h       2019-02-20 02:24:19.000000000 +0100
- +++ libmagic/cdf.h    2019-06-29 20:07:54.074996599 +0200
+++++ libmagic/cdf.h    2020-03-02 15:04:23.675416900 +0100
  @@ -35,10 +35,10 @@
   #ifndef _H_CDF_
   #define _H_CDF_
   #endif
   #ifdef __DJGPP__
   #define timespec timeval
 -@@ -272,7 +273,7 @@
 - typedef struct {
 -      uint16_t ce_namlen;
 -      uint32_t ce_num;
 --     uint64_t ce_timestamp; 
 -+     uint64_t ce_timestamp;
 -      uint16_t ce_name[256];
 - } cdf_catalog_entry_t;
 - 
+ @@ -48,6 +48,7 @@
+  typedef int32_t cdf_secid_t;
+  
+  #define CDF_LOOP_LIMIT                                       10000
+ +#define CDF_ELEMENT_LIMIT                            100000
+  
+  #define CDF_SECID_NULL                                       0
+  #define CDF_SECID_FREE                                       -1
  diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
 ---- libmagic.orig/cdf_time.c  2017-03-29 17:57:48.000000000 +0200
 -+++ libmagic/cdf_time.c       2020-02-26 09:55:13.849044200 +0100
 +--- libmagic.orig/cdf_time.c  2019-03-12 21:43:05.000000000 +0100
- +++ libmagic/cdf_time.c       2019-06-29 20:07:54.074996599 +0200
+++++ libmagic/cdf_time.c       2020-03-02 15:04:23.676413000 +0100
  @@ -23,6 +23,7 @@
    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGE.
                return buf;
        (void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
  diff -u libmagic.orig/compress.c libmagic/compress.c
 ---- libmagic.orig/compress.c  2017-11-02 21:25:39.000000000 +0100
 -+++ libmagic/compress.c       2020-02-26 09:55:13.850043300 +0100
 -@@ -2,7 +2,7 @@
 -  * Copyright (c) Ian F. Darwin 1986-1995.
 -  * Software written by Ian F. Darwin and others;
 -  * maintained 1995-present by Christos Zoulas and others.
 -- * 
 -+ *
 -  * Redistribution and use in source and binary forms, with or without
 -  * modification, are permitted provided that the following conditions
 -  * are met:
 -@@ -12,7 +12,7 @@
 -  * 2. Redistributions in binary form must reproduce the above copyright
 -  *    notice, this list of conditions and the following disclaimer in the
 -  *    documentation and/or other materials provided with the distribution.
 -- *  
 -+ *
 -  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 -  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 -  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 -@@ -29,13 +29,13 @@
 -  * compress routines:
 -  *   zmagic() - returns 0 if not recognized, uncompresses and prints
 -  *              information if recognized
 -- *   uncompress(method, old, n, newch) - uncompress old into new, 
 -+ *   uncompress(method, old, n, newch) - uncompress old into new,
 -  *                                       using method, return sizeof new
 -  */
 - #include "file.h"
 - 
 - #ifndef lint
 --FILE_RCSID("@(#)$File: compress.c,v 1.106 2017/11/02 20:25:39 christos Exp $")
 -+FILE_RCSID("@(#)$File: compress.c,v 1.104 2017/03/29 15:57:48 christos Exp $")
 - #endif
 - 
 - #include "magic.h"
 -@@ -45,15 +45,13 @@
 +--- libmagic.orig/compress.c  2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/compress.c       2019-06-29 20:07:54.078996542 +0200
+++++ libmagic/compress.c       2020-03-02 15:04:23.676413000 +0100
 +@@ -45,13 +45,11 @@
   #endif
   #include <string.h>
   #include <errno.h>
                return makeerror(newch, n, "No buffer, %s", strerror(errno));
   
        z.next_in = CCAST(Bytef *, old);
 -@@ -518,7 +476,7 @@
 -      rc = inflateEnd(&z);
 -      if (rc != Z_OK)
 -              goto err;
 --     
 -+
 -      /* let's keep the nul-terminate tradition */
 -      (*newch)[*n] = '\0';
 - 
 -@@ -586,7 +544,7 @@
 -      int status;
 - 
 -      closefd(fdp[STDIN_FILENO], 0);
 --     /* 
 -+     /*
 -       * fork again, to avoid blocking because both
 -       * pipes filled
 -       */
 -@@ -689,13 +647,13 @@
 -                      fdp[STDIN_FILENO][0] = fd;
 -                      (void) lseek(fd, (off_t)0, SEEK_SET);
 -              }
 --             
 -+
 -              for (i = 0; i < __arraycount(fdp); i++)
 -                      copydesc(CAST(int, i), fdp[i]);
 - 
 -              (void)execvp(compr[method].argv[0],
 -                  (char *const *)(intptr_t)compr[method].argv);
 --             dprintf(STDERR_FILENO, "exec `%s' failed, %s", 
 -+             dprintf(STDERR_FILENO, "exec `%s' failed, %s",
 -                  compr[method].argv[0], strerror(errno));
 -              exit(1);
 -              /*NOTREACHED*/
 -@@ -711,7 +669,7 @@
 -              if (fd == -1)
 -                      writechild(fdp, old, *n);
 - 
 --             *newch = CAST(unsigned char *, malloc(bytes_max + 1));
 -+             *newch = CAST(unsigned char *, emalloc(bytes_max + 1));
 -              if (*newch == NULL) {
 -                      rv = makeerror(newch, n, "No buffer, %s",
 -                          strerror(errno));
 -@@ -730,7 +688,7 @@
 -                      r = filter_error(*newch, r);
 -                      break;
 -              }
 --             free(*newch);
 -+             efree(*newch);
 -              if  (r == 0)
 -                      rv = makeerror(newch, n, "Read failed, %s",
 -                          strerror(errno));
 -@@ -738,27 +696,5 @@
 -                      rv = makeerror(newch, n, "No data");
 -              goto err;
 -      }
 --
 --     *n = r;
 --     /* NUL terminate, as every buffer is handled here. */
 --     (*newch)[*n] = '\0';
 --err:
 --     closefd(fdp[STDIN_FILENO], 1);
 --     closefd(fdp[STDOUT_FILENO], 0);
 --     closefd(fdp[STDERR_FILENO], 0);
 --     if (wait(&status) == -1) {
 --             free(*newch);
 --             rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
 --             DPRINTF("Child wait return %#x\n", status);
 --     } else if (!WIFEXITED(status)) {
 --             DPRINTF("Child not exited (%#x)\n", status);
 --     } else if (WEXITSTATUS(status) != 0) {
 --             DPRINTF("Child exited (%#x)\n", WEXITSTATUS(status));
 --     }
 --
 --     closefd(fdp[STDIN_FILENO], 0);
 --     DPRINTF("Returning %p n=%zu rv=%d\n", *newch, *n, rv);
 --    
 --     return rv;
 +@@ -831,3 +830,4 @@
 +      return rv;
   }
 --#endif
 -+#endif /* if PHP_FILEINFO_UNCOMPRESS */
 + #endif
 ++#endif
  diff -u libmagic.orig/der.c libmagic/der.c
 ---- libmagic.orig/der.c       2017-02-10 19:14:01.000000000 +0100
 -+++ libmagic/der.c    2020-02-26 09:55:13.851044000 +0100
 +--- libmagic.orig/der.c       2019-02-20 03:35:27.000000000 +0100
- +++ libmagic/der.c    2019-06-29 20:07:54.078996542 +0200
+++++ libmagic/der.c    2020-03-02 15:04:23.677412900 +0100
  @@ -51,7 +51,9 @@
   #include "magic.h"
   #include "der.h"
                uint32_t z = i << 1;
                if (z < blen - 2)
                        snprintf(buf + z, blen - z, "%.2x", d[i]);
 -@@ -343,7 +346,7 @@
 -      default:
 -              break;
 -      }
 --             
 -+
 -      for (uint32_t i = 0; i < len; i++)
 -              printf("%.2x", d[i]);
 -      printf("\n");
 -@@ -367,7 +370,7 @@
 -              if (p + x >= ep)
 -                      break;
 -              uint32_t len = getlength(p, &x, ep - p + x);
 --             
 -+
 -              printf("%zu %zu-%zu %c,%c,%s,%u:", level, ox, x,
 -                  der_class[c], der_type[t],
 -                  der_tag(buf, sizeof(buf), tag), len);
  diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
 ---- libmagic.orig/elfclass.h  2014-12-17 00:18:40.000000000 +0100
 -+++ libmagic/elfclass.h       2020-02-26 09:55:13.852043400 +0100
 -@@ -1,7 +1,7 @@
 - /*
 -  * Copyright (c) Christos Zoulas 2008.
 -  * All Rights Reserved.
 -- * 
 -+ *
 -  * Redistribution and use in source and binary forms, with or without
 -  * modification, are permitted provided that the following conditions
 -  * are met:
 -@@ -11,7 +11,7 @@
 -  * 2. Redistributions in binary form must reproduce the above copyright
 -  *    notice, this list of conditions and the following disclaimer in the
 -  *    documentation and/or other materials provided with the distribution.
 -- *  
 -+ *
 -  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 -  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 -  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 +--- libmagic.orig/elfclass.h  2019-02-20 02:30:19.000000000 +0100
- +++ libmagic/elfclass.h       2019-06-29 20:07:54.078996542 +0200
+++++ libmagic/elfclass.h       2020-03-02 15:04:23.679414300 +0100
  @@ -41,7 +41,7 @@
                        return toomany(ms, "program headers", phnum);
                flags |= FLAGS_IS_CORE;
                if (shnum > ms->elf_shnum_max)
                        return toomany(ms, "section headers", shnum);
                if (doshn(ms, clazz, swap, fd,
 --                 (off_t)elf_getu(swap, elfhdr.e_shoff), shnum,
 -+                 (zend_off_t)elf_getu(swap, elfhdr.e_shoff), shnum,
 -                  (size_t)elf_getu16(swap, elfhdr.e_shentsize),
 +-                 CAST(off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
 ++                 CAST(zend_off_t, elf_getu(swap, elfhdr.e_shoff)), shnum,
 +                  CAST(size_t, elf_getu16(swap, elfhdr.e_shentsize)),
                    fsize, elf_getu16(swap, elfhdr.e_machine),
 -                  (int)elf_getu16(swap, elfhdr.e_shstrndx),
 +                  CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
  diff -u libmagic.orig/encoding.c libmagic/encoding.c
 ---- libmagic.orig/encoding.c  2017-11-02 21:25:39.000000000 +0100
 -+++ libmagic/encoding.c       2020-02-26 09:55:13.854045100 +0100
 -@@ -88,12 +88,12 @@
 +--- libmagic.orig/encoding.c  2019-04-15 18:48:41.000000000 +0200
- +++ libmagic/encoding.c       2019-06-29 20:07:54.078996542 +0200
+++++ libmagic/encoding.c       2020-03-02 15:04:23.680413600 +0100
 +@@ -89,13 +89,13 @@
        *code_mime = "binary";
   
        mlen = (nbytes + 1) * sizeof((*ubuf)[0]);
        return rv;
   }
  diff -u libmagic.orig/file.h libmagic/file.h
 ---- libmagic.orig/file.h      2018-03-11 01:46:42.000000000 +0100
 -+++ libmagic/file.h   2020-02-26 09:55:13.856043400 +0100
 -@@ -27,21 +27,15 @@
 -  */
 - /*
 -  * file.h - definitions for file(1) program
 -- * @(#)$File: file.h,v 1.191 2018/02/21 21:26:00 christos Exp $
 -+ * @(#)$File: file.h,v 1.182 2017/04/07 19:46:44 christos Exp $
 -  */
 - 
 +--- libmagic.orig/file.h      2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/file.h   2019-06-29 20:32:19.553528888 +0200
+++++ libmagic/file.h   2020-03-02 15:04:23.682414300 +0100
 +@@ -33,18 +33,9 @@
   #ifndef __file_h__
   #define __file_h__
   
   #define __RCSID(a)
   #endif
  diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
 ---- libmagic.orig/fsmagic.c   2017-05-24 21:17:50.000000000 +0200
 -+++ libmagic/fsmagic.c        2020-02-26 09:55:13.857043000 +0100
 -@@ -2,7 +2,7 @@
 -  * Copyright (c) Ian F. Darwin 1986-1995.
 -  * Software written by Ian F. Darwin and others;
 -  * maintained 1995-present by Christos Zoulas and others.
 -- * 
 -+ *
 -  * Redistribution and use in source and binary forms, with or without
 -  * modification, are permitted provided that the following conditions
 -  * are met:
 -@@ -12,7 +12,7 @@
 -  * 2. Redistributions in binary form must reproduce the above copyright
 -  *    notice, this list of conditions and the following disclaimer in the
 -  *    documentation and/or other materials provided with the distribution.
 -- *  
 -+ *
 -  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 -  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 -  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 -@@ -63,26 +63,10 @@
 +--- libmagic.orig/fsmagic.c   2019-05-07 04:26:48.000000000 +0200
- +++ libmagic/fsmagic.c        2019-06-29 20:07:54.082996485 +0200
+++++ libmagic/fsmagic.c        2020-03-02 15:04:23.683417500 +0100
 +@@ -66,26 +66,10 @@
   # define minor(dev)  ((dev) & 0xff)
   #endif
   #undef HAVE_MAJOR
   #ifndef __COHERENT__
        case S_IFSOCK:
  diff -u libmagic.orig/funcs.c libmagic/funcs.c
 ---- libmagic.orig/funcs.c     2017-11-02 21:25:39.000000000 +0100
 -+++ libmagic/funcs.c  2020-02-26 09:55:13.859042500 +0100
 +--- libmagic.orig/funcs.c     2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/funcs.c  2019-06-29 20:07:54.082996485 +0200
+++++ libmagic/funcs.c  2020-03-02 15:04:23.684415800 +0100
  @@ -31,7 +31,6 @@
   #endif       /* lint */
   
                if (ms->c.li == NULL) {
                        file_oomem(ms, len);
                        return -1;
- @@ -513,76 +520,41 @@
 -@@ -464,76 +470,38 @@
++@@ -513,76 +520,38 @@
   protected int
   file_replace(struct magic_set *ms, const char *pat, const char *rep)
   {
   }
   
   protected file_pushbuf_t *
- @@ -593,7 +565,7 @@
 -@@ -544,7 +512,7 @@
++@@ -593,7 +562,7 @@
        if (ms->event_flags & EVENT_HAD_ERR)
                return NULL;
   
                return NULL;
   
        pb->buf = ms->o.buf;
- @@ -611,8 +583,8 @@
 -@@ -562,8 +530,8 @@
++@@ -611,8 +580,8 @@
        char *rbuf;
   
        if (ms->event_flags & EVENT_HAD_ERR) {
                return NULL;
        }
   
- @@ -621,7 +593,7 @@
 -@@ -572,7 +540,7 @@
++@@ -621,7 +590,7 @@
        ms->o.buf = pb->buf;
        ms->offset = pb->offset;
   
   }
   
  diff -u libmagic.orig/magic.c libmagic/magic.c
 ---- libmagic.orig/magic.c     2017-08-28 15:39:18.000000000 +0200
 -+++ libmagic/magic.c  2020-02-26 09:55:13.861044300 +0100
 +--- libmagic.orig/magic.c     2019-05-07 04:27:11.000000000 +0200
- +++ libmagic/magic.c  2019-06-29 20:07:54.082996485 +0200
+++++ libmagic/magic.c  2020-03-02 15:04:23.686413600 +0100
  @@ -25,11 +25,6 @@
    * SUCH DAMAGE.
    */
   public const char *
   magic_error(struct magic_set *ms)
  diff -u libmagic.orig/magic.h libmagic/magic.h
- --- libmagic.orig/magic.h     2019-06-29 20:13:10.290924369 +0200
- +++ libmagic/magic.h  2019-06-29 20:11:37.732033650 +0200
 ---- libmagic.orig/magic.h     2020-02-26 09:56:58.945274100 +0100
 -+++ libmagic/magic.h  2020-02-26 09:55:13.862044300 +0100
 -@@ -122,6 +122,7 @@
++--- libmagic.orig/magic.h     2020-03-02 15:06:39.235737800 +0100
+++++ libmagic/magic.h  2020-03-02 15:04:23.686413600 +0100
 +@@ -124,6 +124,7 @@
   
   const char *magic_getpath(const char *, int);
   const char *magic_file(magic_t, const char *);
   const char *magic_buffer(magic_t, const void *, size_t);
   
  diff -u libmagic.orig/print.c libmagic/print.c
 ---- libmagic.orig/print.c     2017-02-10 19:14:01.000000000 +0100
 -+++ libmagic/print.c  2020-02-26 09:55:13.864043900 +0100
 -@@ -2,7 +2,7 @@
 -  * Copyright (c) Ian F. Darwin 1986-1995.
 -  * Software written by Ian F. Darwin and others;
 -  * maintained 1995-present by Christos Zoulas and others.
 -- * 
 -+ *
 -  * Redistribution and use in source and binary forms, with or without
 -  * modification, are permitted provided that the following conditions
 -  * are met:
 -@@ -12,7 +12,7 @@
 -  * 2. Redistributions in binary form must reproduce the above copyright
 -  *    notice, this list of conditions and the following disclaimer in the
 -  *    documentation and/or other materials provided with the distribution.
 -- *  
 -+ *
 -  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 -  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 -  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 +--- libmagic.orig/print.c     2019-03-12 21:43:05.000000000 +0100
- +++ libmagic/print.c  2019-06-29 20:07:54.082996485 +0200
+++++ libmagic/print.c  2020-03-02 15:04:23.688414000 +0100
  @@ -28,6 +28,7 @@
   /*
    * print.c - debugging printout routines
        if (pp == NULL)
                goto out;
  diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
 ---- libmagic.orig/readcdf.c   2017-11-02 21:25:39.000000000 +0100
 -+++ libmagic/readcdf.c        2020-02-26 09:55:13.865044100 +0100
 +--- libmagic.orig/readcdf.c   2019-03-12 21:43:05.000000000 +0100
- +++ libmagic/readcdf.c        2019-06-29 22:10:43.100179773 +0200
+++++ libmagic/readcdf.c        2020-03-02 15:04:23.689414500 +0100
  @@ -31,7 +31,11 @@
   
   #include <assert.h>
        return NULL;
   }
   
- @@ -112,30 +112,14 @@
 -@@ -116,30 +116,24 @@
++@@ -112,30 +112,24 @@
   {
        size_t i;
        const char *rv = NULL;
        return rv;
   }
   
- @@ -151,7 +135,9 @@
 -@@ -155,6 +149,8 @@
 -         const char *s, *e;
 -         int len;
++@@ -151,7 +145,9 @@
 +      const char *s, *e;
 +      int len;
   
 +-     if (!NOTMIME(ms) && root_storage)
  +     memset(&ts, 0, sizeof(ts));
  +
 -         if (!NOTMIME(ms) && root_storage)
 ++        if (!NOTMIME(ms) && root_storage)
                str = cdf_clsid_to_mime(root_storage->d_storage_uuid,
                    clsid2mime);
 -@@ -281,10 +277,10 @@
 + 
- @@ -277,10 +263,10 @@
++@@ -277,10 +273,10 @@
                        if (file_printf(ms, "%s%s",
                            cdf_u16tos8(buf, ce[i].ce_namlen, ce[i].ce_name),
                            i == cat->cat_num - 1 ? "]" : ", ") == -1) {
                        }
  -             free(cat);
  +             efree(cat);
 -      } else {
 +      } else if (ms->flags & MAGIC_MIME_TYPE) {
                if (file_printf(ms, "application/CDFV2") == -1)
                        return -1;
- @@ -341,7 +327,7 @@
 -@@ -345,7 +341,7 @@
++@@ -341,7 +337,7 @@
        }
   
 -         m = cdf_file_property_info(ms, info, count, root_storage);
 --        free(info);
 -+        efree(info);
 +      m = cdf_file_property_info(ms, info, count, root_storage);
 +-     free(info);
 ++     efree(info);
   
 -         return m == -1 ? -2 : m;
 +      return m == -1 ? -2 : m;
   }
- @@ -651,11 +637,11 @@
 -@@ -353,11 +349,11 @@
 - #ifdef notdef
 - private char *
 - format_clsid(char *buf, size_t len, const uint64_t uuid[2]) {
 --     snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4" 
 -+     snprintf(buf, len, "%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4"
 -          PRIx64 "-%.12" PRIx64,
 -          (uuid[0] >> 32) & (uint64_t)0x000000000ffffffffULL,
 -          (uuid[0] >> 16) & (uint64_t)0x0000000000000ffffULL,
 --         (uuid[0] >>  0) & (uint64_t)0x0000000000000ffffULL, 
 -+         (uuid[0] >>  0) & (uint64_t)0x0000000000000ffffULL,
 -          (uuid[1] >> 48) & (uint64_t)0x0000000000000ffffULL,
 -          (uuid[1] >>  0) & (uint64_t)0x0000fffffffffffffULL);
 -      return buf;
 -@@ -436,7 +432,7 @@
 -      const char *sections[5];
 -      const int  types[5];
 - } sectioninfo[] = {
 --     { "Encrypted", "encrypted", 
 -+     { "Encrypted", "encrypted",
 -              {
 -                      "EncryptedPackage", "EncryptedSummary",
 -                      NULL, NULL, NULL,
 -@@ -448,7 +444,7 @@
 - 
 -              },
 -      },
 --     { "QuickBooks", "quickbooks", 
 -+     { "QuickBooks", "quickbooks",
 -              {
 - #if 0
 -                      "TaxForms", "PDFTaxForms", "modulesInBackup",
 -@@ -655,11 +651,11 @@
++@@ -651,11 +647,11 @@
        cdf_zero_stream(&scn);
        cdf_zero_stream(&sst);
   out3:
 --        free(dir.dir_tab);
 -+        efree(dir.dir_tab);
 +-     free(dir.dir_tab);
 ++     efree(dir.dir_tab);
   out2:
 --        free(ssat.sat_tab);
 -+        efree(ssat.sat_tab);
 +-     free(ssat.sat_tab);
 ++     efree(ssat.sat_tab);
   out1:
 --        free(sat.sat_tab);
 -+        efree(sat.sat_tab);
 +-     free(sat.sat_tab);
 ++     efree(sat.sat_tab);
   out0:
 -      if (i == -1) {
 -          if (NOTMIME(ms)) {
 +      /* If we handled it already, return */
 +      if (i != -1)
  diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
 ---- libmagic.orig/softmagic.c 2018-04-15 20:49:15.000000000 +0200
 -+++ libmagic/softmagic.c      2020-02-26 09:55:13.866043500 +0100
 +--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
- +++ libmagic/softmagic.c      2019-06-29 20:07:54.086996427 +0200
+++++ libmagic/softmagic.c      2020-03-02 15:04:23.690413500 +0100
  @@ -43,6 +43,10 @@
   #include <time.h>
   #include "der.h"
   #define FLT (STRING_BINTEST | STRING_TEXTTEST)
                     ((text && (m->str_flags & FLT) == STRING_BINTEST) ||
                      (!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
- @@ -463,45 +469,30 @@
 -@@ -416,42 +422,28 @@
++@@ -463,45 +469,28 @@
   private int
   check_fmt(struct magic_set *ms, const char *fmt)
   {
  -#endif /* HAVE_STRNDUP */
  -
   static int
 - varexpand(char *buf, size_t len, const struct buffer *b, const char *str)
 + varexpand(struct magic_set *ms, char *buf, size_t len, const char *str)
   {
- @@ -796,15 +787,11 @@
 -@@ -743,14 +735,10 @@
++@@ -796,15 +785,11 @@
                char *cp;
                int rval;
   
   
                if (rval == -1)
                        return -1;
- @@ -1555,9 +1542,6 @@
 -@@ -1135,7 +1123,7 @@
 -                       * string by p->s, so we need to deduct sz.
 -                       * Because we can use one of the bytes of the length
 -                       * after we shifted as NUL termination.
 --                      */ 
 -+                      */
 -                      len = sz;
 -              }
 -              while (len--)
 -@@ -1209,7 +1197,7 @@
 -                      goto out;
 -              return 1;
 -      case FILE_BEDOUBLE:
 --             p->q = BE64(p); 
 -+             p->q = BE64(p);
 -              if (cvt_double(p, m) == -1)
 -                      goto out;
 -              return 1;
 -@@ -1481,8 +1469,6 @@
 -              return -1;
 -      }
 - 
 --
 --
 -      if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
 -          (uint32_t)nbytes, m) == -1)
 -              return -1;
 -@@ -1494,9 +1480,6 @@
 -                  m->type, m->flag, offset, o, nbytes,
++@@ -1555,9 +1540,6 @@
                    *indir_count, *name_count);
 -              mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
 +              mdebug(offset, RCAST(char *, RCAST(void *, p)),
 +                  sizeof(union VALUETYPE));
  -#ifndef COMPILE_ONLY
  -             file_mdump(m);
  -#endif
        }
   
        if (m->flag & INDIR) {
- @@ -1685,7 +1669,7 @@
 -@@ -1609,9 +1592,6 @@
++@@ -1685,7 +1667,7 @@
 +                      offset = do_ops(m, SEXT(sgn,64,BE64(p)), off);
 +                      break;
 +              default:
 +-                     abort();
 ++                     break;
 +              }
 + 
 +              if (m->flag & INDIROFFADD) {
- @@ -1706,9 +1690,6 @@
++@@ -1706,9 +1688,6 @@
                if ((ms->flags & MAGIC_DEBUG) != 0) {
 -                      mdebug(offset, (char *)(void *)p,
 +                      mdebug(offset, RCAST(char *, RCAST(void *, p)),
                            sizeof(union VALUETYPE));
  -#ifndef COMPILE_ONLY
  -                     file_mdump(m);
                }
        }
   
- @@ -1792,17 +1773,16 @@
 -@@ -1696,15 +1676,15 @@
++@@ -1792,17 +1771,16 @@
 + 
                if (rv == 1) {
                        if ((ms->flags & MAGIC_NODESC) == 0 &&
 -                          file_printf(ms, F(ms, m->desc, "%u"), offset) == -1) {
 +-                         file_printf(ms, F(ms, m->desc, "%u"), offset) == -1)
 +-                     {
  -                             free(rbuf);
 ++                         file_printf(ms, F(ms, m->desc, "%u"), offset) == -1) {
  +                             if (rbuf) efree(rbuf);
                                return -1;
                        }
                return rv;
   
        case FILE_USE:
- @@ -1926,6 +1906,47 @@
 -@@ -1827,6 +1807,41 @@
++@@ -1926,6 +1904,47 @@
        return file_strncmp(a, b, len, flags);
   }
   
   private int
   magiccheck(struct magic_set *ms, struct magic *m)
   {
- @@ -2104,65 +2125,77 @@
 -@@ -1987,65 +2002,77 @@
++@@ -2104,65 +2123,77 @@
                break;
        }
        case FILE_REGEX: {
        }
        case FILE_INDIRECT:
  diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
 ---- libmagic.orig/strcasestr.c        2014-05-13 18:48:12.000000000 +0200
 +--- libmagic.orig/strcasestr.c        2014-09-11 17:05:33.000000000 +0200
- +++ libmagic/strcasestr.c     2019-06-29 20:07:54.086996427 +0200
+ +++ libmagic/strcasestr.c     2019-04-02 11:56:06.853152400 +0200
  @@ -39,6 +39,8 @@
   
   #include "file.h"