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 */
238 +/* XXX disabling default magic loading so the compiled in data is used */
318 file_error(ms, errno, "cannot read magic file `%s'",
352 - if ((*ma = CAST(struct magic *, malloc(slen))) == NULL) {
353 + if ((*ma = CAST(struct magic *, emalloc(slen))) == NULL) {
399 + /* XXX the maxmagic has to be reset each time we load some new magic file.
473 if (map->magic[j])
474 - free(map->magic[j]);
475 + efree(map->magic[j]);
493 struct magic *nm;
495 - if ((nm = CAST(struct magic *, realloc(me->mp,
496 + if ((nm = CAST(struct magic *, erealloc(me->mp,
504 - if ((m = CAST(struct magic *, malloc(len))) == NULL) {
505 + if ((m = CAST(struct magic *, emalloc(len))) == NULL) {
660 file_error(ms, 0, "bad magic in `%s'", dbname);
665 - file_error(ms, 0, "File %s supports only version %d magic "
667 + file_error(ms, 0, "File %d.%d supports only version %d magic "
672 - entries = (uint32_t)(st.st_size / sizeof(struct magic));
673 - if ((off_t)(entries * sizeof(struct magic)) != st.st_size) {
676 - sizeof(struct magic));
688 + nentries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
689 + entries = (uint32_t)(st.sb.st_size / sizeof(struct magic));
690 + if ((off_t)(entries * sizeof(struct magic)) != st.sb.st_size) {
693 + sizeof(struct magic));
697 map->magic[0] = CAST(struct magic *, map->p) + 1;
700 map->magic[i + 1] = map->magic[i] + map->nmagic[i];
712 byteswap(map->magic[i], map->nmagic[i]);
774 + if (php_stream_seek(stream,(off_t)sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
781 - if (write(fd, map->magic[i], len) != (ssize_t)len) {
782 + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
1203 const char magic[8];
1378 #define MAGIC "/etc/magic"
1418 /* list of magic entries */
1420 struct magic *magic; /* array of magic entries */
1460 protected uint64_t file_signextend(struct magic_set *, struct magic *,
1462 +protected void file_delmagic(struct magic *, int type, size_t entries);
1472 -protected void file_mdump(struct magic *);
1481 protected size_t file_pstring_length_size(const struct magic *);
1482 protected size_t file_pstring_get_length(const struct magic *, const char *);
2074 /* try soft magic tests */
2208 diff -u libmagic.orig/magic.c libmagic/magic.c
2209 --- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
2210 +++ libmagic/magic.c Sun Jan 4 17:02:29 2015
2224 #include "magic.h"
2293 - if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
2294 + if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
2327 /* Third, try to get magic file relative to dll location */
2552 diff -u libmagic.orig/magic.h libmagic/magic.h
2553 --- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
2554 +++ libmagic/magic.h Sun Jan 4 17:02:29 2015
2602 -file_mdump(struct magic *m)
2894 private int match(struct magic_set *, struct magic *, uint32_t,
2897 private int32_t moffset(struct magic_set *, struct magic *);
2901 + const unsigned char *, uint32_t, size_t, struct magic *);
2902 private int mconvert(struct magic_set *, struct magic *, int);
2904 private int handle_annotation(struct magic_set *, struct magic *);
2906 private void cvt_32(union VALUETYPE *, const struct magic *);
2907 private void cvt_64(union VALUETYPE *, const struct magic *);
2924 if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
2931 struct magic *m = &magic[magindex];
2943 - while (magic[magindex+1].cont_level != 0 &&
2945 + while (magindex + 1 < nmagic && magic[magindex+1].cont_level != 0 &&
2947 m = &magic[magindex];
2952 check_fmt(struct magic_set *ms, struct magic *m)
3003 mprint(struct magic_set *ms, struct magic *m)
3072 + const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
3230 /* Verify we have enough data to match magic type */
3365 magiccheck(struct magic_set *ms, struct magic *m)