]> granicus.if.org Git - php/commitdiff
Sync one more upstream libmagic piece
authorAnatol Belski <ab@php.net>
Fri, 9 Nov 2018 23:18:30 +0000 (00:18 +0100)
committerAnatol Belski <ab@php.net>
Fri, 9 Nov 2018 23:19:42 +0000 (00:19 +0100)
ext/fileinfo/libmagic/softmagic.c

index 4b10e846644faf11e89dd89de75c700c84bd3119..5894a1b76358b5934fafbcedfb2422a70a67d285 100644 (file)
@@ -657,15 +657,12 @@ mprint(struct magic_set *ms, struct magic *m)
                t = ms->offset + sizeof(double);
                break;
 
+       case FILE_SEARCH:
        case FILE_REGEX: {
                char *cp;
                int rval;
 
                cp = estrndup((const char *)ms->search.s, ms->search.rm_len);
-               if (cp == NULL) {
-                       file_oomem(ms, ms->search.rm_len);
-                       return -1;
-               }
                rval = file_printf(ms, F(ms, m, "%s"),
                    file_printable(sbuf, sizeof(sbuf), cp));
                efree(cp);
@@ -680,15 +677,6 @@ mprint(struct magic_set *ms, struct magic *m)
                break;
        }
 
-       case FILE_SEARCH:
-               if (file_printf(ms, F(ms, m, "%s"), m->value.s) == -1)
-                       return -1;
-               if ((m->str_flags & REGEX_OFFSET_START))
-                       t = ms->search.offset;
-               else
-                       t = ms->search.offset + m->vallen;
-               break;
-
        case FILE_DEFAULT:
        case FILE_CLEAR:
                if (file_printf(ms, "%s", m->desc) == -1)