Lines Matching refs:magic

5   * apprentice - make one pass through /etc/magic, learning its secrets.
16 #include "magic.h"
117 - file_magwarn(ms, "using regular magic file `%s'", fn);
121 + file_magwarn(ms, "using regular magic file `%s'", fn);
200 + if (map->magic[j]) {
201 + efree(map->magic[j]);
232 /* const char *fn: list of magic files and directories */
237 +/* XXX disabling default magic loading so the compiled in data is used */
313 file_error(ms, errno, "cannot read magic file `%s'",
339 - if ((*ma = CAST(struct magic *, malloc(slen))) == NULL) {
340 + if ((*ma = CAST(struct magic *, emalloc(slen))) == NULL) {
447 if (map->magic[j])
448 - free(map->magic[j]);
449 + efree(map->magic[j]);
467 struct magic *nm;
469 - if ((nm = CAST(struct magic *, realloc(me->mp,
470 + if ((nm = CAST(struct magic *, erealloc(me->mp,
478 - if ((m = CAST(struct magic *, malloc(len))) == NULL) {
479 + if ((m = CAST(struct magic *, emalloc(len))) == NULL) {
630 file_error(ms, 0, "bad magic in `%s'", dbname);
635 - file_error(ms, 0, "File %s supports only version %d magic "
637 + file_error(ms, 0, "File %d.%d supports only version %d magic "
642 - entries = (uint32_t)(st.st_size / sizeof(struct magic));
643 - if ((off_t)(entries * sizeof(struct magic)) != st.st_size) {
646 - sizeof(struct magic));
658 + nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
659 + entries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
660 + if ((off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
663 + sizeof(struct magic));
667 map->magic[0] = CAST(struct magic *, map->p) + 1;
670 map->magic[i + 1] = map->magic[i] + map->nmagic[i];
682 byteswap(map->magic[i], map->nmagic[i]);
740 + if (php_stream_seek(stream,(off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
747 - if (write(fd, map->magic[i], len) != (ssize_t)len) {
748 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
1194 const char magic[8];
1369 #define MAGIC "/etc/magic"
1428 protected uint64_t file_signextend(struct magic_set *, struct magic *,
1430 +protected void file_delmagic(struct magic *, int type, size_t entries);
1440 -protected void file_mdump(struct magic *);
1449 protected size_t file_pstring_length_size(const struct magic *);
1450 protected size_t file_pstring_get_length(const struct magic *, const char *);
1837 #include "magic.h"
2024 /* try soft magic tests */
2167 diff -u libmagic.orig/magic.c libmagic/magic.c
2168 --- libmagic.orig/magic.c 2016-01-25 11:17:38.161978563 +0800
2169 +++ libmagic/magic.c 2016-01-25 11:19:37.411347842 +0800
2183 #include "magic.h"
2252 - if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
2253 + if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
2286 /* Third, try to get magic file relative to dll location */
2506 diff -u libmagic.orig/magic.h libmagic/magic.h
2507 --- libmagic.orig/magic.h 2016-01-25 11:17:38.139978563 +0800
2508 +++ libmagic/magic.h 2016-01-25 11:19:37.412347842 +0800
2568 -file_mdump(struct magic *m)
3004 private int match(struct magic_set *, struct magic *, uint32_t,
3007 private int32_t moffset(struct magic_set *, struct magic *);
3011 + const unsigned char *, uint32_t, size_t, struct magic *);
3012 private int mconvert(struct magic_set *, struct magic *, int);
3014 private int handle_annotation(struct magic_set *, struct magic *);
3016 private void cvt_32(union VALUETYPE *, const struct magic *);
3017 private void cvt_64(union VALUETYPE *, const struct magic *);
3026 struct magic *m = &magic[magindex];
3038 - while (magic[magindex+1].cont_level != 0 &&
3040 + while (magindex + 1 < nmagic && magic[magindex+1].cont_level != 0 &&
3042 m = &magic[magindex];
3047 check_fmt(struct magic_set *ms, struct magic *m)
3098 mprint(struct magic_set *ms, struct magic *m)
3167 + const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
3322 magiccheck(struct magic_set *ms, struct magic *m)