diff options
-rw-r--r-- | src/ascmagic.c | 6 | ||||
-rw-r--r-- | src/softmagic.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/ascmagic.c b/src/ascmagic.c index 130b1722..43d467cd 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -49,7 +49,7 @@ #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.44 2006/03/02 22:08:22 christos Exp $") +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.45 2006/03/12 22:09:33 christos Exp $") #endif /* lint */ typedef unsigned long unichar; @@ -154,8 +154,10 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes) } } - if (nbytes <= 1) + if (nbytes <= 1) { + rv = 0; goto done; + } /* * for troff, look for . + letter + letter or .\"; diff --git a/src/softmagic.c b/src/softmagic.c index 2e78fdcb..edcba5e5 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -39,7 +39,7 @@ #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.77 2005/10/20 14:59:01 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.78 2006/03/12 22:09:33 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -664,6 +664,11 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, * (starting at 1), not as bytes-from start-of-file */ char *b, *c, *last = NULL; + if (s == NULL) { + p->search.buflen = 0; + p->search.buf = NULL; + return 0; + } if ((p->search.buf = strdup((const char *)s)) == NULL) { file_oomem(ms); return -1; |